Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Apr 2009 05:07:18 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r191044 - user/thompsa/vaptq/sys/net80211
Message-ID:  <200904140507.n3E57IZ9095061@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Tue Apr 14 05:07:17 2009
New Revision: 191044
URL: http://svn.freebsd.org/changeset/base/191044

Log:
  Drain the state task before removing the vap from the tailq, this should make
  driver teardown safe.

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

Modified: user/thompsa/vaptq/sys/net80211/ieee80211.c
==============================================================================
--- user/thompsa/vaptq/sys/net80211/ieee80211.c	Tue Apr 14 04:59:57 2009	(r191043)
+++ user/thompsa/vaptq/sys/net80211/ieee80211.c	Tue Apr 14 05:07:17 2009	(r191044)
@@ -562,7 +562,16 @@ ieee80211_vap_detach(struct ieee80211vap
 	 * while we cleanup internal state but that is hard.
 	 */
 	ieee80211_stop_locked(vap);
+	IEEE80211_UNLOCK(ic);
+
+	/*
+	 * Flush any deferred vap tasks.
+	 * NB: must be before ether_ifdetach() and removal from ic_vaps list
+	 */
+	taskqueue_drain(ic->ic_tq, &vap->iv_nstate_task);
 
+	IEEE80211_LOCK(ic);
+	KASSERT(vap->iv_state == IEEE80211_S_INIT , ("vap still running"));
 	TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next);
 	ieee80211_syncflag_locked(ic, IEEE80211_F_WME);
 #ifdef IEEE80211_SUPPORT_SUPERG
@@ -576,12 +585,6 @@ ieee80211_vap_detach(struct ieee80211vap
 	ieee80211_syncifflag_locked(ic, IFF_ALLMULTI);
 	IEEE80211_UNLOCK(ic);
 
-	/*
-	 * Flush any deferred vap tasks.
-	 * NB: must be before ether_ifdetach();
-	 */
-	taskqueue_drain(ic->ic_tq, &vap->iv_nstate_task);
-
 	/* XXX can't hold com lock */
 	/* NB: bpfattach is called by ether_ifdetach and claims all taps */
 	ether_ifdetach(ifp);



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