1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sat, 26 Mar 2022 23:58:35 +0100
3 Subject: [PATCH] mac80211: do not wake queues on a vif that is being stopped
5 When a vif is being removed and sdata->bss is cleared, __ieee80211_wake_txqs
6 can still be called on it, which crashes as soon as sdata->bss is being
8 To fix this properly, check for SDATA_STATE_RUNNING before waking queues,
9 and take the fq lock when setting it (to ensure that __ieee80211_wake_txqs
10 observes the change when running on a different CPU
12 Signed-off-by: Felix Fietkau <nbd@nbd.name>
15 --- a/net/mac80211/iface.c
16 +++ b/net/mac80211/iface.c
17 @@ -377,7 +377,9 @@ static void ieee80211_do_stop(struct iee
19 struct cfg80211_nan_func *func;
21 + spin_lock_bh(&local->fq.lock);
22 clear_bit(SDATA_STATE_RUNNING, &sdata->state);
23 + spin_unlock_bh(&local->fq.lock);
25 cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata;
27 --- a/net/mac80211/util.c
28 +++ b/net/mac80211/util.c
29 @@ -301,6 +301,9 @@ static void __ieee80211_wake_txqs(struct
33 + if (!test_bit(SDATA_STATE_RUNNING, &sdata->state))
36 if (sdata->vif.type == NL80211_IFTYPE_AP)