Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108405051
D43967.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D43967.diff
View Options
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -1275,25 +1275,6 @@
lsta = ni->ni_drv_data;
LKPI_80211_LVIF_LOCK(lvif);
- /* Re-check given (*iv_update_bss) could have happened. */
- /* XXX-BZ KASSERT later? or deal as error? */
- if (lvif->lvif_bss_synched || lvif->lvif_bss != NULL)
- ic_printf(vap->iv_ic, "%s:%d: lvif %p vap %p iv_bss %p lvif_bss %p "
- "lvif_bss->ni %p synched %d, ni %p lsta %p\n", __func__, __LINE__,
- lvif, vap, vap->iv_bss, lvif->lvif_bss,
- (lvif->lvif_bss != NULL) ? lvif->lvif_bss->ni : NULL,
- lvif->lvif_bss_synched, ni, lsta);
-
- /*
- * Reference the ni for this cache of lsta/ni on lvif->lvif_bss
- * essentially out lsta version of the iv_bss.
- * Do NOT use iv_bss here anymore as that may have diverged from our
- * function local ni already and would lead to inconsistencies.
- */
- ieee80211_ref_node(ni);
- lvif->lvif_bss = lsta;
- lvif->lvif_bss_synched = true;
-
/* Insert the [l]sta into the list of known stations. */
TAILQ_INSERT_TAIL(&lvif->lsta_head, lsta, lsta_entry);
LKPI_80211_LVIF_UNLOCK(lvif);
@@ -1342,11 +1323,56 @@
* (ideally we'd do that on a callback for something else ...)
*/
+ LKPI_80211_LHW_UNLOCK(lhw);
+ IEEE80211_LOCK(vap->iv_ic);
+
+ LKPI_80211_LVIF_LOCK(lvif);
+ /* Re-check given (*iv_update_bss) could have happened while we were unlocked. */
+ if (lvif->lvif_bss_synched || lvif->lvif_bss != NULL ||
+ lsta->ni != vap->iv_bss)
+ ic_printf(vap->iv_ic, "%s:%d: lvif %p vap %p iv_bss %p lvif_bss %p "
+ "lvif_bss->ni %p synched %d, ni %p lsta %p\n", __func__, __LINE__,
+ lvif, vap, vap->iv_bss, lvif->lvif_bss,
+ (lvif->lvif_bss != NULL) ? lvif->lvif_bss->ni : NULL,
+ lvif->lvif_bss_synched, ni, lsta);
+
+ /*
+ * Reference the "ni" for caching the lsta/ni in lvif->lvif_bss.
+ * Given we cache lsta we use lsta->ni instead of ni here (even though
+ * lsta->ni == ni) to be distinct from the rest of the code where we do
+ * assume that ni == vap->iv_bss which it may or may not be.
+ * So do NOT use iv_bss here anymore as that may have diverged from our
+ * function local ni already while ic was unlocked and would lead to
+ * inconsistencies. Go and see if we lost a race and do not update
+ * lvif_bss_synched in that case.
+ */
+ ieee80211_ref_node(lsta->ni);
+ lvif->lvif_bss = lsta;
+ if (lsta->ni == vap->iv_bss) {
+ lvif->lvif_bss_synched = true;
+ } else {
+ /* Set to un-synched no matter what. */
+ lvif->lvif_bss_synched = false;
+ /*
+ * We do not error as someone has to take us down.
+ * If we are followed by a 2nd, new net80211::join1() going to
+ * AUTH lkpi_sta_a_to_a() will error, lkpi_sta_auth_to_{scan,init}()
+ * will take the lvif->lvif_bss node down eventually.
+ * What happens with the vap->iv_bss node will entirely be up
+ * to net80211 as we never used the node beyond alloc()/free()
+ * and we do not hold an extra reference for that anymore given
+ * ni : lsta == 1:1.
+ */
+ }
+ LKPI_80211_LVIF_UNLOCK(lvif);
+ goto out_relocked;
+
out:
LKPI_80211_LHW_UNLOCK(lhw);
IEEE80211_LOCK(vap->iv_ic);
+out_relocked:
/*
- * Release the reference that keop the ni stable locally
+ * Release the reference that kept the ni stable locally
* during the work of this function.
*/
if (ni != NULL)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 25, 12:52 PM (16 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16143171
Default Alt Text
D43967.diff (3 KB)
Attached To
Mode
D43967: LinuxKPI: 802.11: close race lkpi_sta_scan_to_auth()/(*iv_update_bss)()
Attached
Detach File
Event Timeline
Log In to Comment