Skip to contentSkip to conversation

mt7601u: let mac80211 validate rx CCMP PN

PATCH In review Lorenzo Bianconi 2 participants 2 messages Mar 9, 2018 – Mar 13, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 1/1 mt7601u: let mac80211 validate rx CCMP PN

In reply to a message not in the archive

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 c869f77d6abb ("add mt7601u driver")
---
 drivers/net/wireless/mediatek/mt7601u/initvals.h |  1 +
 drivers/net/wireless/mediatek/mt7601u/mac.c      | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt7601u/initvals.h +1 -0
index ec11ff66969d..2dc6b68e7fb9 100644
@@ -139,6 +139,7 @@ static const struct mt76_reg_pair mac_common_vals[] = {
 	{ MT_TXOP_HLDR_ET,		0x00000002 },
 	{ MT_XIFS_TIME_CFG,		0x33a41010 },
 	{ MT_PWR_PIN_CFG,		0x00000000 },
+	{ MT_PN_PAD_MODE,		0x00000001 },
 };
 
 static const struct mt76_reg_pair mac_chip_vals[] = {
drivers/net/wireless/mediatek/mt7601u/mac.c +9 -1
index 4d3077941138..d55d7040a56d 100644
@@ -480,8 +480,16 @@ u32 mt76_mac_process_rx(struct mt7601u_dev *dev, struct sk_buff *skb,
 
 	if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_DECRYPT)) {
 		status->flag |= RX_FLAG_DECRYPTED;
-		status->flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_MMIC_STRIPPED;
+		status->flag |= RX_FLAG_MMIC_STRIPPED;
+		status->flag |= RX_FLAG_MIC_STRIPPED;
+		status->flag |= RX_FLAG_ICV_STRIPPED;
+		status->flag |= RX_FLAG_IV_STRIPPED;
 	}
+	/* let mac80211 take care of PN validation since apparently
+	 * the hardware does not support it
+	 */
+	if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_PN_LEN))
+		status->flag &= ~RX_FLAG_IV_STRIPPED;
 
 	status->chains = BIT(0);
 	rssi = mt7601u_phy_get_rssi(dev, rxwi, rate);
Signature · 1 line
2.14.3
#2 lore raw
Quoted 11 lines · Lorenzo Bianconi

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 c869f77d6abb ("add mt7601u driver")

Patch applied to wireless-drivers-next.git, thanks.

a9eab62d4164 mt7601u: let mac80211 validate rx CCMP PN

Signature · 3 lines
https://patchwork.kernel.org/patch/10270239/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches