Commit 23976efedd5ecb420b87455787c537eb4aed1981
Committed by
John W. Linville
1 parent
1bcca3c463
Exists in
master
and in
4 other branches
mac80211: don't accept WEP keys other than WEP40 and WEP104
This patch makes mac80211 refuse a WEP key whose length is not WEP40 nor WEP104. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Showing 2 changed files with 16 additions and 0 deletions Side-by-side Diff
include/net/mac80211.h
... | ... | @@ -595,6 +595,15 @@ |
595 | 595 | ALG_CCMP, |
596 | 596 | }; |
597 | 597 | |
598 | +/** | |
599 | + * enum ieee80211_key_len - key length | |
600 | + * @WEP40: WEP 5 byte long key | |
601 | + * @WEP104: WEP 13 byte long key | |
602 | + */ | |
603 | +enum ieee80211_key_len { | |
604 | + LEN_WEP40 = 5, | |
605 | + LEN_WEP104 = 13, | |
606 | +}; | |
598 | 607 | |
599 | 608 | /** |
600 | 609 | * enum ieee80211_key_flags - key flags |
net/mac80211/wext.c
... | ... | @@ -95,6 +95,13 @@ |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | + if (alg == ALG_WEP && | |
99 | + key_len != LEN_WEP40 && key_len != LEN_WEP104) { | |
100 | + ieee80211_key_free(key); | |
101 | + err = -EINVAL; | |
102 | + goto out_unlock; | |
103 | + } | |
104 | + | |
98 | 105 | ieee80211_key_link(key, sdata, sta); |
99 | 106 | |
100 | 107 | if (set_tx_key || (!sta && !sdata->default_key && key)) |