Skip to content

Commit a9eab62

Browse files
LorenzoBianconiKalle Valo
authored andcommitted
mt7601u: let mac80211 validate rx CCMP PN
Apparently the hardware does not perform CCMP PN validation so let mac80211 take care of possible replay attacks in sw. Moreover indicate ICV and MIC had been stripped setting corresponding bits in ieee80211_rx_status. The fix has been validated using 4.2.1 and 4.1.3 tests from the WiFi Alliance vulnerability detection tool. Fixes: c869f77 ("add mt7601u driver") Acked-by: Jakub Kicinski <[email protected]> Tested-by: David Park <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 2f04652 commit a9eab62

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

drivers/net/wireless/mediatek/mt7601u/initvals.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ static const struct mt76_reg_pair mac_common_vals[] = {
139139
{ MT_TXOP_HLDR_ET, 0x00000002 },
140140
{ MT_XIFS_TIME_CFG, 0x33a41010 },
141141
{ MT_PWR_PIN_CFG, 0x00000000 },
142+
{ MT_PN_PAD_MODE, 0x00000001 },
142143
};
143144

144145
static const struct mt76_reg_pair mac_chip_vals[] = {

drivers/net/wireless/mediatek/mt7601u/mac.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,16 @@ u32 mt76_mac_process_rx(struct mt7601u_dev *dev, struct sk_buff *skb,
480480

481481
if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_DECRYPT)) {
482482
status->flag |= RX_FLAG_DECRYPTED;
483-
status->flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_MMIC_STRIPPED;
483+
status->flag |= RX_FLAG_MMIC_STRIPPED;
484+
status->flag |= RX_FLAG_MIC_STRIPPED;
485+
status->flag |= RX_FLAG_ICV_STRIPPED;
486+
status->flag |= RX_FLAG_IV_STRIPPED;
484487
}
488+
/* let mac80211 take care of PN validation since apparently
489+
* the hardware does not support it
490+
*/
491+
if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_PN_LEN))
492+
status->flag &= ~RX_FLAG_IV_STRIPPED;
485493

486494
status->chains = BIT(0);
487495
rssi = mt7601u_phy_get_rssi(dev, rxwi, rate);

0 commit comments

Comments
 (0)