ath lor
Adrian Chadd
adrian.chadd at gmail.com
Fri Jul 27 19:21:39 UTC 2012
Ok, hm. I wonder if the "correct" thing to do here is to ensure the
comlock is NOT held when iterating through nodes.
I don't know if net80211 ever had the lock hierarchy defined/designed
in any detail. So it's either:
* ieee80211_iterate_nodes() shouldn't be called with the
comlock/nodelock/node iterate lock held;
* ieee80211_iterate_nodes() must always be called with the comlock held.
I bet it's the former. The latter is too scary. :-)
I'll add a lock witness check on a local device and get a backtrace.
If you'd like to immediately crash your device, you could do the same.
If you're feeling very brave and immediately crash-y, try:
Index: sys/net80211/ieee80211_node.c
===================================================================
--- sys/net80211/ieee80211_node.c (revision 238389)
+++ sys/net80211/ieee80211_node.c (working copy)
@@ -2163,6 +2163,12 @@
struct ieee80211_node *ni;
u_int gen;
+ /*
+ * To avoid LORs, ic must not be held here as the
+ * called function may acquire ic.
+ */
+ IEEE80211_UNLOCK_ASSERT(nt->nt_ic);
+
IEEE80211_NODE_ITERATE_LOCK(nt);
gen = ++nt->nt_scangen;
restart:
Index: sys/net80211/ieee80211_freebsd.h
===================================================================
--- sys/net80211/ieee80211_freebsd.h (revision 238389)
+++ sys/net80211/ieee80211_freebsd.h (working copy)
@@ -53,6 +53,8 @@
#define IEEE80211_UNLOCK(_ic) mtx_unlock(IEEE80211_LOCK_OBJ(_ic))
#define IEEE80211_LOCK_ASSERT(_ic) \
mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED)
+#define IEEE80211_UNLOCK_ASSERT(_ic) \
+ mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_NOTOWNED)
/*
* Node locking definitions.
Adrian
More information about the freebsd-wireless
mailing list