From c1367aa3f146b1605ae2d7614c8a0bb05b3f44e3 Mon Sep 17 00:00:00 2001 From: adrian Date: Sat, 18 Feb 2012 09:18:06 +0000 Subject: 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.) --- sys/dev/ath/if_ath.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sys/dev/ath/if_ath.c') 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); -- cgit v1.1