public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211: fix scan abort sanity checks
@ 2009-10-31  6:44 Johannes Berg
  0 siblings, 0 replies; only message in thread
From: Johannes Berg @ 2009-10-31  6:44 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, mcgrof

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>
---
 net/mac80211/scan.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

--- wireless-testing.orig/net/mac80211/scan.c	2009-10-31 07:29:47.000000000 +0100
+++ wireless-testing/net/mac80211/scan.c	2009-10-31 07:31:21.000000000 +0100
@@ -288,10 +288,14 @@ void ieee80211_scan_completed(struct iee
 
 	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);



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-31  6:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-31  6:44 [PATCH] mac80211: fix scan abort sanity checks Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox