Skip to content

Commit 76a3059

Browse files
committed
wifi: mac80211: drop some unprotected action frames
We should not receive/handle unicast protected dual or public action frames that aren't protected, so drop them - in the latter case of course only if MFP is used. Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Gregory Greenman <[email protected]> Link: https://lore.kernel.org/r/20230619161906.eb4461108129.I3c2223cf29d8a3586dfc74b2dda3f6fa2a4eea7c@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 2cc7add commit 76a3059

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

net/mac80211/rx.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,9 +2405,9 @@ static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc)
24052405

24062406
static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
24072407
{
2408-
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
24092408
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb);
2410-
__le16 fc = hdr->frame_control;
2409+
struct ieee80211_mgmt *mgmt = (void *)rx->skb->data;
2410+
__le16 fc = mgmt->frame_control;
24112411

24122412
/*
24132413
* Pass through unencrypted frames if the hardware has
@@ -2416,6 +2416,11 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
24162416
if (status->flag & RX_FLAG_DECRYPTED)
24172417
return 0;
24182418

2419+
/* drop unicast protected dual (that wasn't protected) */
2420+
if (ieee80211_is_action(fc) &&
2421+
mgmt->u.action.category == WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION)
2422+
return -EACCES;
2423+
24192424
if (rx->sta && test_sta_flag(rx->sta, WLAN_STA_MFP)) {
24202425
if (unlikely(!ieee80211_has_protected(fc) &&
24212426
ieee80211_is_unicast_robust_mgmt_frame(rx->skb))) {
@@ -2458,6 +2463,12 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
24582463
if (unlikely(ieee80211_is_action(fc) && !rx->key &&
24592464
ieee80211_is_robust_mgmt_frame(rx->skb)))
24602465
return -EACCES;
2466+
2467+
/* drop unicast public action frames when using MPF */
2468+
if (is_unicast_ether_addr(mgmt->da) &&
2469+
ieee80211_is_public_action((void *)rx->skb->data,
2470+
rx->skb->len))
2471+
return -EACCES;
24612472
}
24622473

24632474
return 0;

0 commit comments

Comments
 (0)