Skip to content

Commit cedc60f

Browse files
nbd168gregkh
authored andcommitted
mac80211: fix encryption key selection for 802.3 xmit
[ Upstream commit b101dd2 ] When using WEP, the default unicast key needs to be selected, instead of the STA PTK. Signed-off-by: Felix Fietkau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 20790b2 commit cedc60f

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

net/mac80211/tx.c

+15-12
Original file line numberDiff line numberDiff line change
@@ -4278,7 +4278,6 @@ netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb,
42784278
struct ethhdr *ehdr = (struct ethhdr *)skb->data;
42794279
struct ieee80211_key *key;
42804280
struct sta_info *sta;
4281-
bool offload = true;
42824281

42834282
if (unlikely(skb->len < ETH_HLEN)) {
42844283
kfree_skb(skb);
@@ -4294,18 +4293,22 @@ netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb,
42944293

42954294
if (unlikely(IS_ERR_OR_NULL(sta) || !sta->uploaded ||
42964295
!test_sta_flag(sta, WLAN_STA_AUTHORIZED) ||
4297-
sdata->control_port_protocol == ehdr->h_proto))
4298-
offload = false;
4299-
else if ((key = rcu_dereference(sta->ptk[sta->ptk_idx])) &&
4300-
(!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) ||
4301-
key->conf.cipher == WLAN_CIPHER_SUITE_TKIP))
4302-
offload = false;
4303-
4304-
if (offload)
4305-
ieee80211_8023_xmit(sdata, dev, sta, key, skb);
4306-
else
4307-
ieee80211_subif_start_xmit(skb, dev);
4296+
sdata->control_port_protocol == ehdr->h_proto))
4297+
goto skip_offload;
4298+
4299+
key = rcu_dereference(sta->ptk[sta->ptk_idx]);
4300+
if (!key)
4301+
key = rcu_dereference(sdata->default_unicast_key);
4302+
4303+
if (key && (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) ||
4304+
key->conf.cipher == WLAN_CIPHER_SUITE_TKIP))
4305+
goto skip_offload;
4306+
4307+
ieee80211_8023_xmit(sdata, dev, sta, key, skb);
4308+
goto out;
43084309

4310+
skip_offload:
4311+
ieee80211_subif_start_xmit(skb, dev);
43094312
out:
43104313
rcu_read_unlock();
43114314

0 commit comments

Comments
 (0)