Skip to content

Commit 35835ff

Browse files
rory-littlegregkh
authored andcommitted
wifi: mt76: mt7921: Place upper limit on station AID
[ Upstream commit 4d0bf21 ] Any station configured with an AID over 20 causes a firmware crash. This situation occurred in our testing using an AP interface on 7922 hardware, with a modified hostapd, sourced from Mediatek's OpenWRT feeds. In stock hostapd, station AIDs begin counting at 1, and this configuration is prevented with an upper limit on associated stations. However, the modified hostapd began allocation at 65, which caused the firmware to crash. This fix does not allow these AIDs to work, but will prevent the firmware crash. This crash was only seen on IFTYPE_AP interfaces, and the fix does not appear to have an effect on IFTYPE_STATION behavior. Fixes: 5c14a5f ("mt76: mt7921: introduce mt7921e support") Signed-off-by: Rory Little <rory@candelatech.com> Link: https://patch.msgid.link/20250904000711.3033860-1-rory@candelatech.com Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e00c276 commit 35835ff

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/net/wireless/mediatek/mt76/mt7921/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,9 @@ int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
808808
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
809809
int ret, idx;
810810

811+
if (sta->aid > MT7921_MAX_AID)
812+
return -ENOENT;
813+
811814
idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1);
812815
if (idx < 0)
813816
return -ENOSPC;
@@ -851,6 +854,9 @@ int mt7921_mac_sta_event(struct mt76_dev *mdev, struct ieee80211_vif *vif,
851854
struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
852855
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
853856

857+
if (sta->aid > MT7921_MAX_AID)
858+
return -ENOENT;
859+
854860
if (ev != MT76_STA_EVENT_ASSOC)
855861
return 0;
856862

drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include "../mt792x.h"
88
#include "regs.h"
99

10+
#define MT7921_MAX_AID 20
11+
1012
#define MT7921_TX_RING_SIZE 2048
1113
#define MT7921_TX_MCU_RING_SIZE 256
1214
#define MT7921_TX_FWDL_RING_SIZE 128

0 commit comments

Comments
 (0)