blob: 431032931943cd5875c389479f992e491ecc6cfe [file] [log] [blame]
developer33907d42022-09-19 14:33:58 +08001From: Alexander Wetzel <alexander@wetzel-home.de>
2Date: Thu, 15 Sep 2022 15:09:46 +0200
3Subject: [PATCH] mac80211: Ensure vif queues are operational after start
4
5Make sure local->queue_stop_reasons and vif.txqs_stopped stay in sync.
6
7When a new vif is created the queues may end up in an inconsistent state
8and be inoperable:
9Communication not using iTXQ will work, allowing to e.g. complete the
10association. But the 4-way handshake will time out. The sta will not
11send out any skbs queued in iTXQs.
12
13All normal attempts to start the queues will fail when reaching this
14state.
15local->queue_stop_reasons will have marked all queues as operational but
16vif.txqs_stopped will still be set, creating an inconsistent internal
17state.
18
19In reality this seems to be race between the mac80211 function
20ieee80211_do_open() setting SDATA_STATE_RUNNING and the wake_txqs_tasklet:
21Depending on the driver and the timing the queues may end up to be
22operational or not.
23
24Cc: stable@vger.kernel.org
25Fixes: f856373e2f31 ("wifi: mac80211: do not wake queues on a vif that is being stopped")
26Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
27---
28
29--- a/net/mac80211/util.c
30+++ b/net/mac80211/util.c
31@@ -301,14 +301,14 @@ static void __ieee80211_wake_txqs(struct
32 local_bh_disable();
33 spin_lock(&fq->lock);
34
35+ sdata->vif.txqs_stopped[ac] = false;
36+
37 if (!test_bit(SDATA_STATE_RUNNING, &sdata->state))
38 goto out;
39
40 if (sdata->vif.type == NL80211_IFTYPE_AP)
41 ps = &sdata->bss->ps;
42
43- sdata->vif.txqs_stopped[ac] = false;
44-
45 list_for_each_entry_rcu(sta, &local->sta_list, list) {
46 if (sdata != sta->sdata)
47 continue;