svn commit: r191678 - user/thompsa/vaptq/sys/net80211

Andrew Thompson thompsa at FreeBSD.org
Thu Apr 30 02:21:25 UTC 2009


Author: thompsa
Date: Thu Apr 30 02:21:24 2009
New Revision: 191678
URL: http://svn.freebsd.org/changeset/base/191678

Log:
  Use TAILQ_FOREACH_SAFE since iv_newstate may drop the com lock.

Modified:
  user/thompsa/vaptq/sys/net80211/ieee80211_proto.c

Modified: user/thompsa/vaptq/sys/net80211/ieee80211_proto.c
==============================================================================
--- user/thompsa/vaptq/sys/net80211/ieee80211_proto.c	Thu Apr 30 01:24:53 2009	(r191677)
+++ user/thompsa/vaptq/sys/net80211/ieee80211_proto.c	Thu Apr 30 02:21:24 2009	(r191678)
@@ -1534,14 +1534,15 @@ static void
 markwaiting(struct ieee80211vap *vap0)
 {
 	struct ieee80211com *ic = vap0->iv_ic;
-	struct ieee80211vap *vap;
+	struct ieee80211vap *vap, *next;
 
 	IEEE80211_LOCK_ASSERT(ic);
 
-	TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
+	TAILQ_FOREACH_SAFE(vap, &ic->ic_vaps, iv_next, next) {
 		if (vap == vap0)
 			continue;
 		if (vap->iv_state != IEEE80211_S_INIT) {
+			/* NB: iv_newstate may drop the lock */
 			vap->iv_newstate(vap, IEEE80211_S_INIT, 0);
 			vap->iv_flags_ext |= IEEE80211_FEXT_SCANWAIT;
 		}
@@ -1558,16 +1559,17 @@ static void
 wakeupwaiting(struct ieee80211vap *vap0)
 {
 	struct ieee80211com *ic = vap0->iv_ic;
-	struct ieee80211vap *vap;
+	struct ieee80211vap *vap, *next;
 
 	IEEE80211_LOCK_ASSERT(ic);
 
-	TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
+	TAILQ_FOREACH_SAFE(vap, &ic->ic_vaps, iv_next, next) {
 		if (vap == vap0)
 			continue;
 		if (vap->iv_flags_ext & IEEE80211_FEXT_SCANWAIT) {
 			vap->iv_flags_ext &= ~IEEE80211_FEXT_SCANWAIT;
 			/* NB: sta's cannot go INIT->RUN */
+			/* NB: iv_newstate may drop the lock */
 			vap->iv_newstate(vap,
 			    vap->iv_opmode == IEEE80211_M_STA ?
 			        IEEE80211_S_SCAN : IEEE80211_S_RUN, 0);


More information about the svn-src-user mailing list