2007-03-16 03:40:56

by Hong Liu

[permalink] [raw]
Subject: [PATCH 1/5] mac80211: fix wrong keyidx will change default key

Signed-off-by: Hong Liu <[email protected]>

---

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



2007-03-23 19:02:35

by Jiri Benc

[permalink] [raw]
Subject: Re: [PATCH 1/5] mac80211: fix wrong keyidx will change default key

On Fri, 16 Mar 2007 11:28:15 +0800, Hong Liu wrote:
> Signed-off-by: Hong Liu <[email protected]>

Applied, thanks for the patch!

Jiri

--
Jiri Benc
SUSE Labs