mt7996_mac_twt_teardown_flow() keeps a flow on dev->twt_list if the delete command fails, for example while a reset is pending, and mt7996_mac_sta_remove() does not take the remaining flows off the list. The list then holds flows inside a station that mac80211 frees, and the next TWT setup reads them in mt7996_mac_twt_sched_list_add(). Take the remaining flows of a station off the list at its removal. Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c index 3028c92c2efb..69f1da5eae1b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c @@ -1985,9 +1985,20 @@ mt7996_mac_sta_remove(struct mt7996_dev *dev, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; + struct mt7996_sta_link *msta_link = &msta->deflink; int i; mutex_lock(&dev->mt76.mutex); + + /* the firmware can still hold an agreement whose delete failed, so + * its table entry stays counted + */ + for (i = 0; i < ARRAY_SIZE(msta_link->twt.flow); i++) { + if (msta_link->twt.flowid_mask & BIT(i)) + list_del_init(&msta_link->twt.flow[i].list); + } + msta_link->twt.flowid_mask = 0; + for (i = 0; i < ARRAY_SIZE(msta->link); i++) mt7996_mac_sta_remove_link(dev, sta, i, true); mutex_unlock(&dev->mt76.mutex); -- 2.47.3