Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Apr 2008 17:44:53 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 139279 for review
Message-ID:  <200804031744.m33HirrD097947@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=139279

Change 139279 by sam@sam_ebb on 2008/04/03 17:44:13

	mark the vap OACTIVE under the com lock to close a race against
	the state machine

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_output.c#46 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_output.c#46 (text+ko) ====

@@ -125,12 +125,18 @@
 	 * for CSA).
 	 */
 	if (vap->iv_state != IEEE80211_S_RUN) {
-		IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
-		    "%s: ignore queue, in %s state\n",
-		    __func__, ieee80211_state_name[vap->iv_state]);
-		vap->iv_stats.is_tx_badstate++;
-		ifp->if_drv_flags |= IFF_DRV_OACTIVE;
-		return;
+		IEEE80211_LOCK(ic);
+		/* re-check under the com lock to avoid races */
+		if (vap->iv_state != IEEE80211_S_RUN) {
+			IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
+			    "%s: ignore queue, in %s state\n",
+			    __func__, ieee80211_state_name[vap->iv_state]);
+			vap->iv_stats.is_tx_badstate++;
+			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+			IEEE80211_UNLOCK(ic);
+			return;
+		}
+		IEEE80211_UNLOCK(ic);
 	}
 	for (;;) {
 		IFQ_DEQUEUE(&ifp->if_snd, m);



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