From patchwork Fri Feb 5 07:06:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 77299 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1577iu7025951 for ; Fri, 5 Feb 2010 07:07:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933246Ab0BEHHn (ORCPT ); Fri, 5 Feb 2010 02:07:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35627 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932913Ab0BEHHn (ORCPT ); Fri, 5 Feb 2010 02:07:43 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1576hmn023787 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 5 Feb 2010 02:06:43 -0500 Received: from [172.17.84.8] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1576gJj001520; Fri, 5 Feb 2010 02:06:42 -0500 Subject: [PATCH] airo: fix WEP key clearing after c0380693520b1a1e4f756799a0edc379378b462a From: Dan Williams To: "John W. Linville" Cc: linux-wireless@vger.kernel.org, stable@kernel.org, Chris Siebenmann , Stanislaw Gruszka In-Reply-To: <1265353178.11066.5.camel@localhost.localdomain> References: <1265121290-2969-1-git-send-email-sgruszka@redhat.com> <20100204120713.GB6068@dhcp-lab-161.englab.brq.redhat.com> <1265353178.11066.5.camel@localhost.localdomain> Date: Thu, 04 Feb 2010 23:06:54 -0800 Message-ID: <1265353614.11066.11.camel@localhost.localdomain> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 05 Feb 2010 07:07:45 +0000 (UTC) diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 4331d67..38902c7 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -5254,11 +5254,8 @@ static int set_wep_key(struct airo_info *ai, u16 index, const char *key, WepKeyRid wkr; int rc; - if (keylen == 0) { - airo_print_err(ai->dev->name, "%s: key length to set was zero", - __func__); + if (WARN_ON (keylen == 0)) return -1; - } memset(&wkr, 0, sizeof(wkr)); wkr.len = cpu_to_le16(sizeof(wkr)); @@ -6532,7 +6529,7 @@ static int airo_set_encodeext(struct net_device *dev, struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; int perm = ( encoding->flags & IW_ENCODE_TEMP ? 0 : 1 ); __le16 currentAuthType = local->config.authType; - int idx, key_len, alg = ext->alg, set_key = 1, rc; + int idx, key_len, alg = ext->alg, rc; wep_key_t key; if (!local->wep_capable) @@ -6566,10 +6563,9 @@ static int airo_set_encodeext(struct net_device *dev, idx, rc); return rc; } - set_key = ext->key_len > 0 ? 1 : 0; } - if (set_key) { + if (ext->key_len > 0) { /* Set the requested key first */ memset(key.key, 0, MAX_KEY_SIZE); switch (alg) { @@ -6600,12 +6596,20 @@ static int airo_set_encodeext(struct net_device *dev, } /* Read the flags */ - if(encoding->flags & IW_ENCODE_DISABLED) + if (encoding->flags & IW_ENCODE_DISABLED) { + /* The firmware seems to need the WEP key RID touched when + * setting WEP disabled; resetting the transmit key index to 0 + * is good enough. Otherwise it gets confused and stops + * delivering scan results (!). + */ + if (!(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) + set_wep_tx_idx(local, 0, 0, 1); local->config.authType = AUTH_OPEN; // disable encryption - if(encoding->flags & IW_ENCODE_RESTRICTED) + } else if (encoding->flags & IW_ENCODE_RESTRICTED) local->config.authType = AUTH_SHAREDKEY; // Only Both - if(encoding->flags & IW_ENCODE_OPEN) + else if (encoding->flags & IW_ENCODE_OPEN) local->config.authType = AUTH_ENCRYPT; // Only Wep + /* Commit the changes to flags if needed */ if (local->config.authType != currentAuthType) set_bit (FLAG_COMMIT, &local->flags);