]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
mac80211: fix deauth TX when we disconnect
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 3 Dec 2018 19:15:49 +0000 (21:15 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 5 Dec 2018 14:34:59 +0000 (15:34 +0100)
commitf6c7f03f69f7422bc237bc79599e152d390b74e0
tree8f9769daba09c1f727c9e8ead2d9ff2e183de7d6
parentc8d10cbda12f14c312dcf7c5a1748625f2c308c1
mac80211: fix deauth TX when we disconnect

The iTXQs stop/wake queue mechanism involves a whole bunch
of locks and this is probably why the call to
ieee80211_wake_txqs is deferred to a tasklet when called from
__ieee80211_wake_queue.

Another advantage of that is that ieee80211_wake_txqs might
call the wake_tx_queue() callback and then the driver may
call mac80211 which will call it back in the same context.

The bug I saw is that when we send a deauth frame as a
station we do:

flush(drop=1)
tx deauth
flush(drop=0)

While we flush we stop the queues and wake them up
immediately after we finished flushing. The problem here is
that the tasklet that de-facto enables the queue may not have
run until we send the deauth. Then the deauth frame is sent
to the driver (which is surprising by itself), but the driver
won't get anything useful from ieee80211_tx_dequeue because
the queue is stopped (or more precisely because
vif->txqs_stopped[0] is true).
Then the deauth is not sent. Later on, the tasklet will run,
but that'll be too late. We'll already have removed all the
vif etc...

Fix this by calling ieee80211_wake_txqs synchronously if we
are not waking up the queues from the driver (we check the
reason to determine that). This makes the code really
convoluted because we may call ieee80211_wake_txqs from
__ieee80211_wake_queue. The latter assumes that
queue_stop_reason_lock has been taken by the caller and
ieee80211_wake_txqs may release the lock to send the frames.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/util.c