developer | 4b17052 | 2022-09-19 14:33:58 +0800 | [diff] [blame] | 1 | From: Alexander Wetzel <alexander@wetzel-home.de> |
| 2 | Date: Thu, 15 Sep 2022 15:09:46 +0200 |
| 3 | Subject: [PATCH] mac80211: Ensure vif queues are operational after start |
| 4 | |
| 5 | Make sure local->queue_stop_reasons and vif.txqs_stopped stay in sync. |
| 6 | |
| 7 | When a new vif is created the queues may end up in an inconsistent state |
| 8 | and be inoperable: |
| 9 | Communication not using iTXQ will work, allowing to e.g. complete the |
| 10 | association. But the 4-way handshake will time out. The sta will not |
| 11 | send out any skbs queued in iTXQs. |
| 12 | |
| 13 | All normal attempts to start the queues will fail when reaching this |
| 14 | state. |
| 15 | local->queue_stop_reasons will have marked all queues as operational but |
| 16 | vif.txqs_stopped will still be set, creating an inconsistent internal |
| 17 | state. |
| 18 | |
| 19 | In reality this seems to be race between the mac80211 function |
| 20 | ieee80211_do_open() setting SDATA_STATE_RUNNING and the wake_txqs_tasklet: |
| 21 | Depending on the driver and the timing the queues may end up to be |
| 22 | operational or not. |
| 23 | |
| 24 | Cc: stable@vger.kernel.org |
| 25 | Fixes: f856373e2f31 ("wifi: mac80211: do not wake queues on a vif that is being stopped") |
| 26 | Signed-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; |