summaryrefslogtreecommitdiffstats
path: root/net/wireless/util.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-05-15 12:38:32 +0300
committerJohn W. Linville <linville@tuxdriver.com>2009-05-20 14:46:25 -0400
commit9f26a952210e44691f784b77bf1f83a500d63f58 (patch)
treea11a5ab475cc8cfa61362e57b6b6c4e018d21996 /net/wireless/util.c
parentcc65965cbb24d2ca2bb70f26cac9d7243349e7e3 (diff)
downloadlinux-9f26a952210e44691f784b77bf1f83a500d63f58.tar.bz2
nl80211: Validate NL80211_ATTR_KEY_SEQ length
Validate RSC (NL80211_ATTR_KEY_SEQ) length in nl80211/cfg80211 instead of having to do this in all the drivers. Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/util.c')
-rw-r--r--net/wireless/util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index beb226e78cd7..b94c8604ad7c 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -181,5 +181,20 @@ int cfg80211_validate_key_settings(struct key_params *params, int key_idx,
return -EINVAL;
}
+ if (params->seq) {
+ switch (params->cipher) {
+ case WLAN_CIPHER_SUITE_WEP40:
+ case WLAN_CIPHER_SUITE_WEP104:
+ /* These ciphers do not use key sequence */
+ return -EINVAL;
+ case WLAN_CIPHER_SUITE_TKIP:
+ case WLAN_CIPHER_SUITE_CCMP:
+ case WLAN_CIPHER_SUITE_AES_CMAC:
+ if (params->seq_len != 6)
+ return -EINVAL;
+ break;
+ }
+ }
+
return 0;
}