Skip to content

Commit 9153561

Browse files
AviSternjmberg-intel
authored andcommitted
wifi: mac80211: don't drop all unprotected public action frames
Not all public action frames have a protected variant. When MFP is enabled drop only public action frames that have a dual protected variant. Fixes: 76a3059 ("wifi: mac80211: drop some unprotected action frames") Signed-off-by: Avraham Stern <[email protected]> Signed-off-by: Gregory Greenman <[email protected]> Link: https://lore.kernel.org/r/20231016145213.2973e3c8d3bb.I6198b8d3b04cf4a97b06660d346caec3032f232a@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent c434b2b commit 9153561

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

include/linux/ieee80211.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4355,6 +4355,35 @@ static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
43554355
return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC;
43564356
}
43574357

4358+
/**
4359+
* ieee80211_is_protected_dual_of_public_action - check if skb contains a
4360+
* protected dual of public action management frame
4361+
* @skb: the skb containing the frame, length will be checked
4362+
*
4363+
* Return: true if the skb contains a protected dual of public action
4364+
* management frame, false otherwise.
4365+
*/
4366+
static inline bool
4367+
ieee80211_is_protected_dual_of_public_action(struct sk_buff *skb)
4368+
{
4369+
u8 action;
4370+
4371+
if (!ieee80211_is_public_action((void *)skb->data, skb->len) ||
4372+
skb->len < IEEE80211_MIN_ACTION_SIZE + 1)
4373+
return false;
4374+
4375+
action = *(u8 *)(skb->data + IEEE80211_MIN_ACTION_SIZE);
4376+
4377+
return action != WLAN_PUB_ACTION_20_40_BSS_COEX &&
4378+
action != WLAN_PUB_ACTION_DSE_REG_LOC_ANN &&
4379+
action != WLAN_PUB_ACTION_MSMT_PILOT &&
4380+
action != WLAN_PUB_ACTION_TDLS_DISCOVER_RES &&
4381+
action != WLAN_PUB_ACTION_LOC_TRACK_NOTI &&
4382+
action != WLAN_PUB_ACTION_FTM_REQUEST &&
4383+
action != WLAN_PUB_ACTION_FTM_RESPONSE &&
4384+
action != WLAN_PUB_ACTION_FILS_DISCOVERY;
4385+
}
4386+
43584387
/**
43594388
* _ieee80211_is_group_privacy_action - check if frame is a group addressed
43604389
* privacy action frame

net/mac80211/rx.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2468,8 +2468,7 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
24682468

24692469
/* drop unicast public action frames when using MPF */
24702470
if (is_unicast_ether_addr(mgmt->da) &&
2471-
ieee80211_is_public_action((void *)rx->skb->data,
2472-
rx->skb->len))
2471+
ieee80211_is_protected_dual_of_public_action(rx->skb))
24732472
return -EACCES;
24742473
}
24752474

0 commit comments

Comments
 (0)