mt76_check_ccmp_pn() marks a replayed frame with RX_FLAG_ONLY_MONITOR, as the drivers mark a frame with an ICV or MIC error. mac80211 honours the flag only in its monitor path. A frame in 802.3 format does not take that path, so such a frame reaches the network stack. The flag also sits on the first subframe of an A-MSDU only, and mac80211 does not check the other subframes, because the IV is stripped. Free an 802.3 frame that is marked for monitor interfaces only, with all its subframes, and mark each subframe of such a frame in 802.11 format. Fixes: 3c1032e12217 ("mt76: allow receiving frames with invalid CCMP PN via monitor interfaces") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mac80211.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 5dbedbca838f..a677c05abe46 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -1629,9 +1629,17 @@ void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames, spin_lock(&dev->rx_lock); while ((skb = __skb_dequeue(frames)) != NULL) { + struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb; struct sk_buff *nskb = skb_shinfo(skb)->frag_list; + bool only_monitor; mt76_check_ccmp_pn(skb); + only_monitor = status->flag & RX_FLAG_ONLY_MONITOR; + if (only_monitor && (status->flag & RX_FLAG_8023)) { + dev_kfree_skb(skb); + continue; + } + skb_shinfo(skb)->frag_list = NULL; mt76_rx_convert(dev, skb, &hw, &link_sta); if (nskb) @@ -1644,6 +1652,10 @@ void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames, nskb = nskb->next; skb->next = NULL; + status = (struct mt76_rx_status *)skb->cb; + if (only_monitor) + status->flag |= RX_FLAG_ONLY_MONITOR; + mt76_rx_convert(dev, skb, &hw, &link_sta); if (nskb) IEEE80211_SKB_RXCB(skb)->flag |= RX_FLAG_AMSDU_MORE; -- 2.47.3