Skip to content

Commit

Permalink
mac80211: keep BHs disabled while calling drv_tx_wake_queue()
Browse files Browse the repository at this point in the history
Drivers typically expect this, as it's the case for almost all cases
where this is called (i.e. from the TX path). Also, the code in mac80211
itself (if the driver calls ieee80211_tx_dequeue()) expects this as it
uses this_cpu_ptr() without additional protection.

This should fix various reports of the problem:
https://bugzilla.kernel.org/show_bug.cgi?id=204127
https://lore.kernel.org/linux-wireless/CAN5HydrWb3o_FE6A1XDnP1E+xS66d5kiEuhHfiGKkLNQokx13Q@mail.gmail.com/
https://lore.kernel.org/lkml/[email protected]/

Cc: [email protected]
Reported-and-tested-by: Jiri Kosina <[email protected]>
Reported-by: Aaron Hill <[email protected]>
Reported-by: Lukas Redlinger <[email protected]>
Reported-by: Oleksii Shevchuk <[email protected]>
Fixes: 21a5d4c ("mac80211: add stop/start logic for software TXQs")
Link: https://lore.kernel.org/r/1569928763-I3e8838c5ecad878e59d4a94eb069a90f6641461a@changeid
Reviewed-by: Toke Høiland-Jørgensen <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
jmberg-intel committed Oct 1, 2019
1 parent 8ed31a2 commit d8dec42
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions net/mac80211/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
struct sta_info *sta;
int i;

spin_lock_bh(&fq->lock);
local_bh_disable();
spin_lock(&fq->lock);

if (sdata->vif.type == NL80211_IFTYPE_AP)
ps = &sdata->bss->ps;
Expand All @@ -273,9 +274,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
&txqi->flags))
continue;

spin_unlock_bh(&fq->lock);
spin_unlock(&fq->lock);
drv_wake_tx_queue(local, txqi);
spin_lock_bh(&fq->lock);
spin_lock(&fq->lock);
}
}

Expand All @@ -288,12 +289,14 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
(ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac)
goto out;

spin_unlock_bh(&fq->lock);
spin_unlock(&fq->lock);

drv_wake_tx_queue(local, txqi);
local_bh_enable();
return;
out:
spin_unlock_bh(&fq->lock);
spin_unlock(&fq->lock);
local_bh_enable();
}

static void
Expand Down

0 comments on commit d8dec42

Please sign in to comment.