mt76_reset_device() runs INIT_LIST_HEAD() on each phy->tx_list while wcids that are not in dev->wcid[] can still be on it, such as a station between .sta_pre_rcu_remove and its removal. The later mt76_wcid_cleanup() of such a wcid then corrupts the list. Take the remaining wcids off the list under the tx_lock. Fixes: 065c79df595a ("wifi: mt76: mt7915: fix list corruption after hardware restart") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mac80211.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index a677c05abe46..85491727dc30 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -893,7 +893,11 @@ static void mt76_reset_phy(struct mt76_phy *phy) if (!phy) return; - INIT_LIST_HEAD(&phy->tx_list); + spin_lock_bh(&phy->dev->tx_lock); + while (!list_empty(&phy->tx_list)) + list_del_init(phy->tx_list.next); + spin_unlock_bh(&phy->dev->tx_lock); + phy->num_sta = 0; phy->chanctx = NULL; mt76_roc_complete(phy); -- 2.47.3