mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: fix race condition in station removal
If there are still pending packets in the tx queue when removing a station, it could possibly lead to a call to further attempts to pull packets from the mac80211 tx queue after it has already been removed from the scheduling list. Prevent this from happening by calling synchronize_rcu after deleting the wcid pointer before further cleaning up the tx queues. To be extra careful, ensure that mtxq->list is always initialized properly. Also drop the useless call to mt76x02_mac_wcid_setup, which only re-assigns the bss index of the wcid entry, but does not help with the cleanup in any way. Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
+3
-2
@@ -214,14 +214,15 @@ int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
int idx = msta->wcid.idx;
|
||||
int i;
|
||||
|
||||
rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
|
||||
synchronize_rcu();
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
mt76_tx_status_check(&dev->mt76, &msta->wcid, true);
|
||||
rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
|
||||
for (i = 0; i < ARRAY_SIZE(sta->txq); i++)
|
||||
mt76_txq_remove(&dev->mt76, sta->txq[i]);
|
||||
mt76x02_mac_wcid_set_drop(dev, idx, true);
|
||||
mt76_wcid_free(dev->mt76.wcid_mask, idx);
|
||||
mt76x02_mac_wcid_setup(dev, idx, 0, NULL);
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user