linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] mac80211: fix wrong keyidx will change default key
@ 2007-03-16  3:28 Hong Liu
  2007-03-23 19:02 ` Jiri Benc
  0 siblings, 1 reply; 2+ messages in thread
From: Hong Liu @ 2007-03-16  3:28 UTC (permalink / raw)
  To: Jiri Benc, John W. Linville; +Cc: linux-wireless

Signed-off-by: Hong Liu <hong.liu@intel.com>

---

 net/mac80211/ieee80211_ioctl.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

e0f38f2908fb5f32bdf4eb1dc197c81fae61fbe1
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index ae224c6..aa8b789 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -2919,19 +2919,17 @@ static int ieee80211_ioctl_siwencode(str
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
 	idx = erq->flags & IW_ENCODE_INDEX;
-	if (idx < 1 || idx > 4) {
-		idx = -1;
-		if (!sdata->default_key)
-			idx = 0;
-		else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
-			if (sdata->default_key == sdata->keys[i]) {
-				idx = i;
-				break;
+	if (idx == 0) {
+		if (sdata->default_key)
+			for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
+				if (sdata->default_key == sdata->keys[i]) {
+					idx = i;
+					break;
+				}
 			}
-		}
-		if (idx < 0)
-			return -EINVAL;
-	} else
+	} else if (idx < 1 || idx > 4)
+		return -EINVAL;
+	else
 		idx--;
 
 	if (erq->flags & IW_ENCODE_DISABLED)
-- 
1.3.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-03-23 19:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-16  3:28 [PATCH 1/5] mac80211: fix wrong keyidx will change default key Hong Liu
2007-03-23 19:02 ` Jiri Benc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).