The firmware that a full reset reloads holds no TWT agreement, but mt7996_mac_full_reset() keeps those of the driver and only runs INIT_LIST_HEAD() on dev->twt_list. The disassociation or the removal of a station with a flow then corrupts the list. Drop the TWT agreements of the driver at a full reset as well. Fixes: 27015b6fbcca ("wifi: mt76: mt7996: enable full system reset support") Fixes: ace5d3b6b49e ("wifi: mt76: mt7996: improve hardware restart reliability") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c index eb0f2dd7bb7f..db8ebbcafe13 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c @@ -2493,6 +2493,7 @@ static void mt7996_mac_full_reset(struct mt7996_dev *dev) { struct ieee80211_hw *hw = mt76_hw(dev); + struct mt7996_twt_flow *flow, *tmp; struct mt7996_phy *phy; LIST_HEAD(list); int i; @@ -2537,7 +2538,16 @@ mt7996_mac_full_reset(struct mt7996_dev *dev) list_del_init(dev->sta_rc_list.next); spin_unlock_bh(&dev->mt76.sta_poll_lock); - INIT_LIST_HEAD(&dev->twt_list); + list_for_each_entry_safe(flow, tmp, &dev->twt_list, list) { + struct mt7996_sta_link *msta_link; + + msta_link = container_of(flow, struct mt7996_sta_link, + twt.flow[flow->id]); + msta_link->twt.flowid_mask &= ~BIT(flow->id); + list_del_init(&flow->list); + } + dev->twt.table_mask = 0; + dev->twt.n_agrt = 0; spin_lock_bh(&dev->wed_rro.lock); list_splice_init(&dev->wed_rro.poll_list, &list); -- 2.47.3