Browse Source

cfg80211: disallow shared key authentication with key index 4

Key index 4 can only be used for an IGTK, so the range checks
for shared key authentication should treat 4 as an error, fix
that in the code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg 9 years ago
parent
commit
b6b5555bc8
2 changed files with 2 additions and 2 deletions
  1. 1 1
      net/wireless/mlme.c
  2. 1 1
      net/wireless/nl80211.c

+ 1 - 1
net/wireless/mlme.c

@@ -222,7 +222,7 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
 	ASSERT_WDEV_LOCK(wdev);
 	ASSERT_WDEV_LOCK(wdev);
 
 
 	if (auth_type == NL80211_AUTHTYPE_SHARED_KEY)
 	if (auth_type == NL80211_AUTHTYPE_SHARED_KEY)
-		if (!key || !key_len || key_idx < 0 || key_idx > 4)
+		if (!key || !key_len || key_idx < 0 || key_idx > 3)
 			return -EINVAL;
 			return -EINVAL;
 
 
 	if (wdev->current_bss &&
 	if (wdev->current_bss &&

+ 1 - 1
net/wireless/nl80211.c

@@ -7388,7 +7388,7 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
 		    (key.p.cipher != WLAN_CIPHER_SUITE_WEP104 ||
 		    (key.p.cipher != WLAN_CIPHER_SUITE_WEP104 ||
 		     key.p.key_len != WLAN_KEY_LEN_WEP104))
 		     key.p.key_len != WLAN_KEY_LEN_WEP104))
 			return -EINVAL;
 			return -EINVAL;
-		if (key.idx > 4)
+		if (key.idx > 3)
 			return -EINVAL;
 			return -EINVAL;
 	} else {
 	} else {
 		key.p.key_len = 0;
 		key.p.key_len = 0;