Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Feb 2012 05:39:00 +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: r232096 - head/sys/net80211
Message-ID:  <201202240539.q1O5d0mE044104@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Fri Feb 24 05:39:00 2012
New Revision: 232096
URL: http://svn.freebsd.org/changeset/base/232096

Log:
  Although it's documented that the vap newstate call can drop the
  comlock, I'd like to find and analyse these cases to see if they
  really are valid.
  
  So, throw in a lock here and wait for the (hopefully!) inevitable
  complaints.

Modified:
  head/sys/net80211/ieee80211_proto.c

Modified: head/sys/net80211/ieee80211_proto.c
==============================================================================
--- head/sys/net80211/ieee80211_proto.c	Fri Feb 24 05:33:11 2012	(r232095)
+++ head/sys/net80211/ieee80211_proto.c	Fri Feb 24 05:39:00 2012	(r232096)
@@ -1615,6 +1615,7 @@ markwaiting(struct ieee80211vap *vap0)
 		if (vap->iv_state != IEEE80211_S_INIT) {
 			/* NB: iv_newstate may drop the lock */
 			vap->iv_newstate(vap, IEEE80211_S_INIT, 0);
+			IEEE80211_LOCK_ASSERT(ic);
 			vap->iv_flags_ext |= IEEE80211_FEXT_SCANWAIT;
 		}
 	}
@@ -1649,6 +1650,7 @@ wakeupwaiting(struct ieee80211vap *vap0)
 			vap->iv_newstate(vap,
 			    vap->iv_opmode == IEEE80211_M_STA ?
 			        IEEE80211_S_SCAN : IEEE80211_S_RUN, 0);
+			IEEE80211_LOCK_ASSERT(ic);
 		}
 	}
 }
@@ -1678,6 +1680,7 @@ ieee80211_newstate_cb(void *xvap, int np
 		    ieee80211_state_name[vap->iv_state],
 		    ieee80211_state_name[IEEE80211_S_INIT], arg);
 		vap->iv_newstate(vap, IEEE80211_S_INIT, arg);
+		IEEE80211_LOCK_ASSERT(ic);
 		vap->iv_flags_ext &= ~IEEE80211_FEXT_REINIT;
 	}
 
@@ -1699,6 +1702,7 @@ ieee80211_newstate_cb(void *xvap, int np
 	    ieee80211_state_name[ostate], ieee80211_state_name[nstate], arg);
 
 	rc = vap->iv_newstate(vap, nstate, arg);
+	IEEE80211_LOCK_ASSERT(ic);
 	vap->iv_flags_ext &= ~IEEE80211_FEXT_STATEWAIT;
 	if (rc != 0) {
 		/* State transition failed */
@@ -1724,7 +1728,9 @@ ieee80211_newstate_cb(void *xvap, int np
 		 * Note this can also happen as a result of SLEEP->RUN
 		 * (i.e. coming out of power save mode).
 		 */
+		IF_LOCK(&vap->iv_ifp->if_snd);
 		vap->iv_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+		IF_UNLOCK(&vap->iv_ifp->if_snd);
 		if_start(vap->iv_ifp);
 
 		/* bring up any vaps waiting on us */



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