mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-22 13:54:57 +08:00
mac80211: fix encryption key selection for 802.3 xmit
When using WEP, the default unicast key needs to be selected, instead of the STA PTK. Signed-off-by: Felix Fietkau <nbd@nbd.name> Link: https://lore.kernel.org/r/20201218184718.93650-4-nbd@nbd.name Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
622d3b4e39
commit
b101dd2d22
@ -4251,7 +4251,6 @@ netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb,
|
|||||||
struct ethhdr *ehdr = (struct ethhdr *)skb->data;
|
struct ethhdr *ehdr = (struct ethhdr *)skb->data;
|
||||||
struct ieee80211_key *key;
|
struct ieee80211_key *key;
|
||||||
struct sta_info *sta;
|
struct sta_info *sta;
|
||||||
bool offload = true;
|
|
||||||
|
|
||||||
if (unlikely(skb->len < ETH_HLEN)) {
|
if (unlikely(skb->len < ETH_HLEN)) {
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
@ -4268,17 +4267,21 @@ netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb,
|
|||||||
if (unlikely(IS_ERR_OR_NULL(sta) || !sta->uploaded ||
|
if (unlikely(IS_ERR_OR_NULL(sta) || !sta->uploaded ||
|
||||||
!test_sta_flag(sta, WLAN_STA_AUTHORIZED) ||
|
!test_sta_flag(sta, WLAN_STA_AUTHORIZED) ||
|
||||||
sdata->control_port_protocol == ehdr->h_proto))
|
sdata->control_port_protocol == ehdr->h_proto))
|
||||||
offload = false;
|
goto skip_offload;
|
||||||
else if ((key = rcu_dereference(sta->ptk[sta->ptk_idx])) &&
|
|
||||||
(!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) ||
|
key = rcu_dereference(sta->ptk[sta->ptk_idx]);
|
||||||
|
if (!key)
|
||||||
|
key = rcu_dereference(sdata->default_unicast_key);
|
||||||
|
|
||||||
|
if (key && (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) ||
|
||||||
key->conf.cipher == WLAN_CIPHER_SUITE_TKIP))
|
key->conf.cipher == WLAN_CIPHER_SUITE_TKIP))
|
||||||
offload = false;
|
goto skip_offload;
|
||||||
|
|
||||||
if (offload)
|
|
||||||
ieee80211_8023_xmit(sdata, dev, sta, key, skb);
|
ieee80211_8023_xmit(sdata, dev, sta, key, skb);
|
||||||
else
|
goto out;
|
||||||
ieee80211_subif_start_xmit(skb, dev);
|
|
||||||
|
|
||||||
|
skip_offload:
|
||||||
|
ieee80211_subif_start_xmit(skb, dev);
|
||||||
out:
|
out:
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user