diff options
Diffstat (limited to 'net/wireless/util.c')
-rw-r--r-- | net/wireless/util.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c index 75899b62bdc9..cf63b635afc0 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -237,14 +237,23 @@ int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev, | |||
237 | case WLAN_CIPHER_SUITE_CCMP_256: | 237 | case WLAN_CIPHER_SUITE_CCMP_256: |
238 | case WLAN_CIPHER_SUITE_GCMP: | 238 | case WLAN_CIPHER_SUITE_GCMP: |
239 | case WLAN_CIPHER_SUITE_GCMP_256: | 239 | case WLAN_CIPHER_SUITE_GCMP_256: |
240 | /* Disallow pairwise keys with non-zero index unless it's WEP | 240 | /* IEEE802.11-2016 allows only 0 and - when using Extended Key |
241 | * or a vendor specific cipher (because current deployments use | 241 | * ID - 1 as index for pairwise keys. |
242 | * pairwise WEP keys with non-zero indices and for vendor | 242 | * @NL80211_KEY_NO_TX is only allowed for pairwise keys when |
243 | * specific ciphers this should be validated in the driver or | 243 | * the driver supports Extended Key ID. |
244 | * hardware level - but 802.11i clearly specifies to use zero) | 244 | * @NL80211_KEY_SET_TX can't be set when installing and |
245 | * validating a key. | ||
245 | */ | 246 | */ |
246 | if (pairwise && key_idx) | 247 | if (params->mode == NL80211_KEY_NO_TX) { |
248 | if (!wiphy_ext_feature_isset(&rdev->wiphy, | ||
249 | NL80211_EXT_FEATURE_EXT_KEY_ID)) | ||
250 | return -EINVAL; | ||
251 | else if (!pairwise || key_idx < 0 || key_idx > 1) | ||
252 | return -EINVAL; | ||
253 | } else if ((pairwise && key_idx) || | ||
254 | params->mode == NL80211_KEY_SET_TX) { | ||
247 | return -EINVAL; | 255 | return -EINVAL; |
256 | } | ||
248 | break; | 257 | break; |
249 | case WLAN_CIPHER_SUITE_AES_CMAC: | 258 | case WLAN_CIPHER_SUITE_AES_CMAC: |
250 | case WLAN_CIPHER_SUITE_BIP_CMAC_256: | 259 | case WLAN_CIPHER_SUITE_BIP_CMAC_256: |