For a group addressed frame whose WLAN_IDX names a peer, mt7915_rx_get_wcid() returns the vif wcid, whose per-TID counters all group keys of the vif share. After a GTK rekey, frames of the new key thus read as replays until their PN passes that of the old key. A frame whose WLAN_IDX names the vif wcid gets no wcid and no replay check. Check a group addressed frame against the counters of its key id, also where WLAN_IDX names the vif wcid. Fixes: e57b7901469f ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 4 +++- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index e458661d750b..0505d55f1c0a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -61,7 +61,7 @@ static struct mt76_wcid *mt7915_rx_get_wcid(struct mt7915_dev *dev, return wcid; if (!wcid->sta) - return NULL; + return mt76_rx_group_wcid(wcid); sta = container_of(wcid, struct mt7915_sta, wcid); if (!sta->vif) @@ -313,6 +313,8 @@ mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb, status->flag |= RX_FLAG_ONLY_MONITOR; unicast = FIELD_GET(MT_RXD3_NORMAL_ADDR_TYPE, rxd3) == MT_RXD3_NORMAL_U2M; + status->group = !unicast; + status->key_id = FIELD_GET(MT_RXD1_NORMAL_KEY_ID, rxd1); idx = FIELD_GET(MT_RXD1_NORMAL_WLAN_IDX, rxd1); status->wcid = mt7915_rx_get_wcid(dev, idx, unicast); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c index 50e67a209693..e604b82635e2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c @@ -258,6 +258,8 @@ static int mt7915_add_interface(struct ieee80211_hw *hw, mvif->sta.wcid.idx = idx; mvif->sta.wcid.tx_info |= MT_WCID_TX_INFO_SET; mt76_wcid_init(&mvif->sta.wcid, phy->mt76->band_idx); + mt76_wcid_rx_group_pn_set(&mvif->sta.wcid, vif, + &mvif->mt76.rx_group_pn); mt7915_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); -- 2.47.3