提交 23976efe 编写于 作者: E Emmanuel Grumbach 提交者: John W. Linville

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: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: NTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 1bcca3c4
...@@ -595,6 +595,15 @@ enum ieee80211_key_alg { ...@@ -595,6 +595,15 @@ enum ieee80211_key_alg {
ALG_CCMP, ALG_CCMP,
}; };
/**
* enum ieee80211_key_len - key length
* @WEP40: WEP 5 byte long key
* @WEP104: WEP 13 byte long key
*/
enum ieee80211_key_len {
LEN_WEP40 = 5,
LEN_WEP104 = 13,
};
/** /**
* enum ieee80211_key_flags - key flags * enum ieee80211_key_flags - key flags
......
...@@ -95,6 +95,13 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, ...@@ -95,6 +95,13 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
} }
} }
if (alg == ALG_WEP &&
key_len != LEN_WEP40 && key_len != LEN_WEP104) {
ieee80211_key_free(key);
err = -EINVAL;
goto out_unlock;
}
ieee80211_key_link(key, sdata, sta); ieee80211_key_link(key, sdata, sta);
if (set_tx_key || (!sta && !sdata->default_key && key)) if (set_tx_key || (!sta && !sdata->default_key && key))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册