For a group addressed frame whose WLAN_IDX names a peer, mt7615_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: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 4 +++- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 0def4ba75817..492d1e1b6f0f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -95,7 +95,7 @@ static struct mt76_wcid *mt7615_rx_get_wcid(struct mt7615_dev *dev, return wcid; if (!wcid->sta) - return NULL; + return mt76_rx_group_wcid(wcid); sta = container_of(wcid, struct mt7615_sta, wcid); if (!sta->vif) @@ -378,6 +378,8 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb) status->flag |= RX_FLAG_ONLY_MONITOR; unicast = (rxd1 & MT_RXD1_NORMAL_ADDR_TYPE) == MT_RXD1_NORMAL_U2M; + status->group = !unicast; + status->key_id = FIELD_GET(MT_RXD1_NORMAL_KEY_ID, rxd1); idx = FIELD_GET(MT_RXD2_NORMAL_WLAN_IDX, rxd2); status->wcid = mt7615_rx_get_wcid(dev, idx, unicast); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c index 175e847f49ef..7af53894edd1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -226,6 +226,8 @@ static int mt7615_add_interface(struct ieee80211_hw *hw, INIT_LIST_HEAD(&mvif->sta.wcid.poll_list); mvif->sta.wcid.idx = idx; mt76_wcid_init(&mvif->sta.wcid, mvif->mt76.band_idx); + mt76_wcid_rx_group_pn_set(&mvif->sta.wcid, vif, + &mvif->mt76.rx_group_pn); mt7615_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); -- 2.47.3