summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_tdma.c
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2011-10-02 02:42:31 +0000
committeradrian <adrian@FreeBSD.org>2011-10-02 02:42:31 +0000
commite4db1744452286cf0ae874147a0706e4eef80e5e (patch)
tree41799f0a121c731123911edcc80de132275765d6 /sys/net80211/ieee80211_tdma.c
parent5f61f37453ab1ec33e8e5eda58b46a0d1f11f78a (diff)
downloadFreeBSD-src-e4db1744452286cf0ae874147a0706e4eef80e5e.zip
FreeBSD-src-e4db1744452286cf0ae874147a0706e4eef80e5e.tar.gz
Fix a panic in the wifi stack when a software beacon miss occurs in the wrong state.
The ieee80211_swbmiss() callout is not called with the ic lock held, so it's quite possible the scheduler will run the callout during a state change. This patch: * changes the swbmiss callout to be locked by the ic lock * enforces the ic lock being held across the beacon vap functions by grabbing it inside beacon_miss() and beacon_swmiss(). This ensures that the ic lock is held (and thus the VAP state stays constant) during beacon miss and software miss processing. Since the callout is removed whilst the ic lock is held, it also ensures that the ic lock can't be called during a state change or exhibit any race conditions seen above. Both Edgar and Joel report that this patch fixes the crash and doesn't introduce new issues. Reported by: Edgar Martinez <emartinez@kbcnetworks.com> Reported by: Joel Dahl <joel@vnode.se> Reported by: emaste
Diffstat (limited to 'sys/net80211/ieee80211_tdma.c')
-rw-r--r--sys/net80211/ieee80211_tdma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/net80211/ieee80211_tdma.c b/sys/net80211/ieee80211_tdma.c
index 8c191ab..ed46c92 100644
--- a/sys/net80211/ieee80211_tdma.c
+++ b/sys/net80211/ieee80211_tdma.c
@@ -285,6 +285,9 @@ static void
tdma_beacon_miss(struct ieee80211vap *vap)
{
struct ieee80211_tdma_state *ts = vap->iv_tdma;
+ struct ieee80211com *ic = vap->iv_ic;
+
+ IEEE80211_LOCK_ASSERT(ic);
KASSERT((vap->iv_ic->ic_flags & IEEE80211_F_SCAN) == 0, ("scanning"));
KASSERT(vap->iv_state == IEEE80211_S_RUN,
OpenPOWER on IntegriCloud