Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Apr 2009 02:21:24 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r191678 - user/thompsa/vaptq/sys/net80211
Message-ID:  <200904300221.n3U2LOcN099007@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



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