summaryrefslogtreecommitdiffstats
path: root/sys/dev/ath/if_ath.c
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2012-02-18 09:18:06 +0000
committeradrian <adrian@FreeBSD.org>2012-02-18 09:18:06 +0000
commitc1367aa3f146b1605ae2d7614c8a0bb05b3f44e3 (patch)
tree592666aad8eec4fe071fd816da99e610b5e311ee /sys/dev/ath/if_ath.c
parent55df9475752bcd5f60df976cf0849a2b12aa9f76 (diff)
downloadFreeBSD-src-c1367aa3f146b1605ae2d7614c8a0bb05b3f44e3.zip
FreeBSD-src-c1367aa3f146b1605ae2d7614c8a0bb05b3f44e3.tar.gz
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.)
Diffstat (limited to 'sys/dev/ath/if_ath.c')
-rw-r--r--sys/dev/ath/if_ath.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 2725bc2..4e1ebf6 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -5711,6 +5711,15 @@ ath_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
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, enum ieee80211_state nstate, int arg)
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);
OpenPOWER on IntegriCloud