Signed-off-by: Hong Liu <hong.liu@xxxxxxxxx> --- 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 - To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html