git: d1057074b277 - main - LinuxKPI: 802.11: assert wiphy lock for lkpi_bss_info_change() and MO

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Thu, 27 Aug 2026 08:00:40 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=d1057074b277443e11b04e8513acdf43fd133123

commit d1057074b277443e11b04e8513acdf43fd133123
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-08-21 14:02:39 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-08-27 07:59:40 +0000

    LinuxKPI: 802.11: assert wiphy lock for lkpi_bss_info_change() and MO
    
    Finish reviewing all callers for lkpi_80211_mo_link_info_changed() and
    lkpi_80211_mo_bss_info_changed(), which are called from
    lkpi_bss_info_change() only.  Add the lockdep_assert_wiphy() to
    lkpi_bss_info_change() and make sure all callers are holding the
    wiphy lock.
    
    PR:             297228
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/src/linux_80211.c        | 7 ++++++-
 sys/compat/linuxkpi/common/src/linux_80211_macops.c | 4 ++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index a3e15c6e7223..fd92f1dcf75b 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -2719,6 +2719,8 @@ lkpi_bss_info_change(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	struct lkpi_vif *lvif;
 	enum ieee80211_bss_changed vif_cfg_bits, link_info_bits;
 
+	lockdep_assert_wiphy(hw->wiphy);
+
 	if (ieee80211_vif_is_mld(vif)) {
 		TODO("This likely needs a subset only; split up into 3 parts.");
 	}
@@ -4238,8 +4240,10 @@ lkpi_iv_sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
 	 * If this direct call to mo_bss_info_changed will not work due to
 	 * locking, see if queue_work() is fast enough.
 	 */
+	wiphy_lock(hw->wiphy);
 	bss_changed = lkpi_update_dtim_tsf(vif, ni, ni->ni_vap, __func__, __LINE__);
 	lkpi_bss_info_change(hw, vif, bss_changed);
+	wiphy_unlock(hw->wiphy);
 }
 
 /*
@@ -4459,13 +4463,14 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
 	TAILQ_INSERT_TAIL(&lhw->lvif_head, lvif, lvif_entry);
 	LKPI_80211_LHW_LVIF_UNLOCK(lhw);
 
+	wiphy_lock(hw->wiphy);
+
 	/* Set bss_info. */
 	bss_changed = 0;
 	lkpi_bss_info_change(hw, vif, bss_changed);
 
 	/* Configure tx queues (conf_tx), default WME & send BSS_CHANGED_QOS. */
 	IMPROVE("Hardcoded values; to fix see 802.11-2016, 9.4.2.29 EDCA Parameter Set element");
-	wiphy_lock(hw->wiphy);
 	for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
 
 		bzero(&txqp, sizeof(txqp));
diff --git a/sys/compat/linuxkpi/common/src/linux_80211_macops.c b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
index 09199862dfb7..06d2ecba8048 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211_macops.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
@@ -602,7 +602,7 @@ lkpi_80211_mo_link_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *v
 	struct lkpi_hw *lhw;
 
 	might_sleep();
-	/* XXX-FINISH all callers for lockdep_assert_wiphy(hw->wiphy); */
+	lockdep_assert_wiphy(hw->wiphy);
 
 	lhw = HW_TO_LHW(hw);
 	if (lhw->ops->link_info_changed == NULL &&
@@ -634,7 +634,7 @@ lkpi_80211_mo_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vi
 {
 	struct lkpi_hw *lhw;
 
-	/* XXX-FINISH all callers for lockdep_assert_wiphy(hw->wiphy); */
+	lockdep_assert_wiphy(hw->wiphy);
 
 	lhw = HW_TO_LHW(hw);
 	if (lhw->ops->bss_info_changed == NULL)