aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/patches/subsys/328-mac80211-do-not-wake-queues-on-a-vif-that-is-being-s.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2022-03-27 00:05:49 +0100
committerFelix Fietkau <nbd@nbd.name>2022-09-15 17:52:28 +0200
commitb3fa0241e2faaf4080f4903c0547949ebcddbc6b (patch)
treed2af93ac858e454b2ef148936849de9ec5bfc83f /package/kernel/mac80211/patches/subsys/328-mac80211-do-not-wake-queues-on-a-vif-that-is-being-s.patch
parent94372ab6e4f05d90e663c3b648d6048bc49afd60 (diff)
downloadupstream-b3fa0241e2faaf4080f4903c0547949ebcddbc6b.tar.gz
upstream-b3fa0241e2faaf4080f4903c0547949ebcddbc6b.tar.bz2
upstream-b3fa0241e2faaf4080f4903c0547949ebcddbc6b.zip
mac80211: backport tx queueing bugfixes add a bug fix for a rare crash
Re-introduce the queue wake fix that was reverted due to a regression, but this time with the follow-up fixes that take care of the regression. Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit 9a93b62f315ad4c9f021c414ed80ba337ab4a01e) (cherry-picked from commit 8b804cae5e039142bc63896a75f15146eca3bebc) (cherry-picked from commit 8b06e06832ebe757246582b65306ad2a2537741f)
Diffstat (limited to 'package/kernel/mac80211/patches/subsys/328-mac80211-do-not-wake-queues-on-a-vif-that-is-being-s.patch')
-rw-r--r--package/kernel/mac80211/patches/subsys/328-mac80211-do-not-wake-queues-on-a-vif-that-is-being-s.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/subsys/328-mac80211-do-not-wake-queues-on-a-vif-that-is-being-s.patch b/package/kernel/mac80211/patches/subsys/328-mac80211-do-not-wake-queues-on-a-vif-that-is-being-s.patch
new file mode 100644
index 0000000000..f0150ddef0
--- /dev/null
+++ b/package/kernel/mac80211/patches/subsys/328-mac80211-do-not-wake-queues-on-a-vif-that-is-being-s.patch
@@ -0,0 +1,38 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Sat, 26 Mar 2022 23:58:35 +0100
+Subject: [PATCH] mac80211: do not wake queues on a vif that is being stopped
+
+When a vif is being removed and sdata->bss is cleared, __ieee80211_wake_txqs
+can still be called on it, which crashes as soon as sdata->bss is being
+dereferenced.
+To fix this properly, check for SDATA_STATE_RUNNING before waking queues,
+and take the fq lock when setting it (to ensure that __ieee80211_wake_txqs
+observes the change when running on a different CPU
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -377,7 +377,9 @@ static void ieee80211_do_stop(struct iee
+ bool cancel_scan;
+ struct cfg80211_nan_func *func;
+
++ spin_lock_bh(&local->fq.lock);
+ clear_bit(SDATA_STATE_RUNNING, &sdata->state);
++ spin_unlock_bh(&local->fq.lock);
+
+ cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata;
+ if (cancel_scan)
+--- a/net/mac80211/util.c
++++ b/net/mac80211/util.c
+@@ -301,6 +301,9 @@ static void __ieee80211_wake_txqs(struct
+ local_bh_disable();
+ spin_lock(&fq->lock);
+
++ if (!test_bit(SDATA_STATE_RUNNING, &sdata->state))
++ goto out;
++
+ if (sdata->vif.type == NL80211_IFTYPE_AP)
+ ps = &sdata->bss->ps;
+