Skip to content

Commit 9eaf183

Browse files
Jouni Malinenjmberg-intel
authored andcommitted
mac80211: Report beacon protection failures to user space
Report received Beacon frames that do not have a valid MME MIC when beacon protection is enabled. This covers both the cases of no MME in the received frame and invalid MIC in the MME. Signed-off-by: Jouni Malinen <jouni@codeaurora.org> Link: https://lore.kernel.org/r/20200401142548.6990-2-jouni@codeaurora.org Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 4d797fc commit 9eaf183

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

‎net/mac80211/rx.c‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,8 +1984,12 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
19841984

19851985
if (mmie_keyidx < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS ||
19861986
mmie_keyidx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS +
1987-
NUM_DEFAULT_BEACON_KEYS)
1987+
NUM_DEFAULT_BEACON_KEYS) {
1988+
cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev,
1989+
skb->data,
1990+
skb->len);
19881991
return RX_DROP_MONITOR; /* unexpected BIP keyidx */
1992+
}
19891993

19901994
rx->key = ieee80211_rx_get_bigtk(rx, mmie_keyidx);
19911995
if (!rx->key)
@@ -2131,6 +2135,10 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
21312135
/* either the frame has been decrypted or will be dropped */
21322136
status->flag |= RX_FLAG_DECRYPTED;
21332137

2138+
if (unlikely(ieee80211_is_beacon(fc) && result == RX_DROP_UNUSABLE))
2139+
cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev,
2140+
skb->data, skb->len);
2141+
21342142
return result;
21352143
}
21362144

@@ -2411,8 +2419,12 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
24112419
return -EACCES;
24122420
}
24132421
if (unlikely(ieee80211_is_beacon(fc) && rx->key &&
2414-
ieee80211_get_mmie_keyidx(rx->skb) < 0))
2422+
ieee80211_get_mmie_keyidx(rx->skb) < 0)) {
2423+
cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev,
2424+
rx->skb->data,
2425+
rx->skb->len);
24152426
return -EACCES;
2427+
}
24162428
/*
24172429
* When using MFP, Action frames are not allowed prior to
24182430
* having configured keys.

0 commit comments

Comments
 (0)