mt7925_mac_fill_rx() sets RX_FLAG_DECRYPTED and RX_FLAG_IV_STRIPPED for every frame whose RXD carries a cipher. That includes a group addressed robust Management frame that the hardware matched with the IGTK. The MME of such a frame stays in place, and the driver installs the IGTK without an IPN. With both flags, ieee80211_rx_h_decrypt() takes the frame as verified and checks neither the MIC nor the IPN. No check of the IPN in the hardware is known. A station with PMF can thus accept a replayed group Deauthentication or Disassociation of its AP. Do not report a frame with a BIP cipher as decrypted. mac80211 then selects the IGTK by the key id of the MME, and checks the IPN and the MIC. It also removes the MME. For an offloaded IGTK, it uses the CMAC key that it keeps. Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7925/mac.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c index a99a2c497458..cc8ea0d37430 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c @@ -423,6 +423,7 @@ mt7925_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb) u8 mode = 0; /* , band_idx; */ u16 seq_ctrl = 0; __le16 fc = 0; + u8 sec_mode; int idx; memset(status, 0, sizeof(*status)); @@ -478,7 +479,9 @@ mt7925_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb) if (rxd1 & MT_RXD1_NORMAL_TKIP_MIC_ERR) status->flag |= RX_FLAG_MMIC_ERROR; - if (FIELD_GET(MT_RXD2_NORMAL_SEC_MODE, rxd2) != 0 && + /* a BIP frame keeps its MME, for mac80211 to check MIC and IPN */ + sec_mode = FIELD_GET(MT_RXD2_NORMAL_SEC_MODE, rxd2); + if (sec_mode != 0 && sec_mode != MT_CIPHER_BIP_CMAC_128 && !(rxd1 & (MT_RXD1_NORMAL_CLM | MT_RXD1_NORMAL_CM))) { status->flag |= RX_FLAG_DECRYPTED; status->flag |= RX_FLAG_IV_STRIPPED; @@ -509,7 +512,7 @@ mt7925_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb) u8 *data = (u8 *)rxd; if (status->flag & RX_FLAG_DECRYPTED) { - switch (FIELD_GET(MT_RXD2_NORMAL_SEC_MODE, rxd2)) { + switch (sec_mode) { case MT_CIPHER_AES_CCMP: case MT_CIPHER_CCMP_CCX: case MT_CIPHER_CCMP_256: -- 2.47.3