Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Feb 2012 09:18:07 +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: r231893 - head/sys/dev/ath
Message-ID:  <201202180918.q1I9I7eZ021002@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sat Feb 18 09:18:06 2012
New Revision: 231893
URL: http://svn.freebsd.org/changeset/base/231893

Log:
  Try to ensure that ieee80211_newstate() and the vap_newstate methods
  hold the lock.
  
  This is part of my series of work to try and capture when net80211
  locking isn't.
  
  ObNote: it'd be nice to be able to mark a lock as "assert if the lock
  is dropped", so I could capture functions which decide that dropping
  and reacquiring the lock is a good idea (without re-checking the
  sanity of the state protected by the lock.)

Modified:
  head/sys/dev/ath/if_ath.c

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Sat Feb 18 00:57:11 2012	(r231892)
+++ head/sys/dev/ath/if_ath.c	Sat Feb 18 09:18:06 2012	(r231893)
@@ -5711,6 +5711,15 @@ ath_newstate(struct ieee80211vap *vap, e
 		ieee80211_state_name[vap->iv_state],
 		ieee80211_state_name[nstate]);
 
+	/*
+	 * net80211 _should_ have the comlock asserted at this point.
+	 * There are some comments around the calls to vap->iv_newstate
+	 * which indicate that it (newstate) may end up dropping the
+	 * lock.  This and the subsequent lock assert check after newstate
+	 * are an attempt to catch these and figure out how/why.
+	 */
+	IEEE80211_LOCK_ASSERT(ic);
+
 	if (vap->iv_state == IEEE80211_S_CSA && nstate == IEEE80211_S_RUN)
 		csa_run_transition = 1;
 
@@ -5760,6 +5769,12 @@ ath_newstate(struct ieee80211vap *vap, e
 	if (error != 0)
 		goto bad;
 
+	/*
+	 * See above: ensure av_newstate() doesn't drop the lock
+	 * on us.
+	 */
+	IEEE80211_LOCK_ASSERT(ic);
+
 	if (nstate == IEEE80211_S_RUN) {
 		/* NB: collect bss node again, it may have changed */
 		ieee80211_free_node(ni);



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