Skip to content

Commit

Permalink
mac80211: fix scan abort sanity checks
Browse files Browse the repository at this point in the history
Since sometimes mac80211 queues up a scan request
to only act on it later, it must be allowed to
(internally) cancel a not-yet-running scan, e.g.
when the interface is taken down. This condition
was missing since we always checked only the
local->scanning variable which isn't yet set in
that situation.

Reported-by: Luis R. Rodriguez <mcgrof@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Nov 2, 2009
1 parent 1933ac4 commit 6d3560d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions net/mac80211/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,14 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)

mutex_lock(&local->scan_mtx);

if (WARN_ON(!local->scanning)) {
mutex_unlock(&local->scan_mtx);
return;
}
/*
* It's ok to abort a not-yet-running scan (that
* we have one at all will be verified by checking
* local->scan_req next), but not to complete it
* successfully.
*/
if (WARN_ON(!local->scanning && !aborted))
aborted = true;

if (WARN_ON(!local->scan_req)) {
mutex_unlock(&local->scan_mtx);
Expand Down

0 comments on commit 6d3560d

Please sign in to comment.