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>
This commit is contained in:
Jouni Malinen
2009-05-15 12:38:32 +03:00
committed by John W. Linville
parent cc65965cbb
commit 9f26a95221
3 changed files with 19 additions and 3 deletions

View File

@@ -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;
}