Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Mar 2012 02:53:44 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232373 - head/sys/net80211
Message-ID:  <201203020253.q222riIG010124@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Fri Mar  2 02:53:43 2012
New Revision: 232373
URL: http://svn.freebsd.org/changeset/base/232373

Log:
  Attempt to catch scan cancellations at exactly the wrong time from occuring.
  
  The scan code unlocks the comlock and calls into the driver.  It then
  assumes the state hasn't changed from underneath it.
  
  Although I haven't seen this particular condition trigger, I'd like to
  be informed if I or anyone else sees it.
  
  What I'm thinking may occur:
  
  * A cancellation comes in during the scan_end call;
  * the cancel flag is set;
  * but it's never checked, so scandone isn't updated;
  * .. and the interface stays in the STA power save mode.
  
  It's a subtle race, if it even exists.
  
  PR:		kern/163318

Modified:
  head/sys/net80211/ieee80211_scan.c

Modified: head/sys/net80211/ieee80211_scan.c
==============================================================================
--- head/sys/net80211/ieee80211_scan.c	Fri Mar  2 00:21:07 2012	(r232372)
+++ head/sys/net80211/ieee80211_scan.c	Fri Mar  2 02:53:43 2012	(r232373)
@@ -960,6 +960,19 @@ scan_task(void *arg, int pending)
 	IEEE80211_LOCK(ic);
 
 	/*
+	 * Since a cancellation may have occured during one of the
+	 * driver calls (whilst unlocked), update scandone.
+	 */
+	if (scandone == 0 &&
+	    ((SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) != 0)) {
+		/* XXX printf? */
+		if_printf(vap->iv_ifp,
+		    "%s: OOPS! scan cancelled during driver call!\n",
+		    __func__);
+	}
+	scandone |= ((SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) != 0);
+
+	/*
 	 * Record scan complete time.  Note that we also do
 	 * this when canceled so any background scan will
 	 * not be restarted for a while.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203020253.q222riIG010124>