git: 9b0e73723f80 - stable/15 - LinuxKPI: 802.11: Always lock around lkpi_80211_mo_{remove_interface,stop}()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Sat, 19 Sep 2026 14:40:32 UTC
The branch stable/15 has been updated by bz:

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

commit 9b0e73723f80e66cd4391b1da94734a4304c7a8f
Author:     Artem Bunichev <temcbun@gmail.com>
AuthorDate: 2026-09-13 21:21:40 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-09-19 09:34:11 +0000

    LinuxKPI: 802.11: Always lock around lkpi_80211_mo_{remove_interface,stop}()
    
    Add the missing locking to another two MO driver downcalls, as drivers
    always expect it (e.g. rtw89 by assertion).
    
    Add the lock and might_sleep assertions to the respective lkpi_80211_mo_*
    downcalls.
    
    PR:             298417
    Reviewed by:    bz
    Differential Revision: https://reviews.freebsd.org/D59608
    
    (cherry picked from commit 73166d21bd831db264509cbdce1ab3b63ab5b189)
---
 sys/compat/linuxkpi/common/src/linux_80211.c        | 2 ++
 sys/compat/linuxkpi/common/src/linux_80211_macops.c | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 18273bc5fd67..562940e35eb9 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -4616,10 +4616,12 @@ lkpi_ic_vap_delete(struct ieee80211vap *vap)
 
 	IMPROVE("clear up other bits in this state");
 
+	wiphy_lock(hw->wiphy);
 	lkpi_80211_mo_remove_interface(hw, vif);
 
 	/* Single VAP, so we can do this here. */
 	lkpi_80211_mo_stop(hw, false);			/* XXX SUSPEND */
+	wiphy_unlock(hw->wiphy);
 
 	mtx_destroy(&lvif->mtx);
 	free(lvif, M_80211_VAP);
diff --git a/sys/compat/linuxkpi/common/src/linux_80211_macops.c b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
index 06d2ecba8048..1ea6bc1dc916 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211_macops.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
@@ -80,6 +80,9 @@ lkpi_80211_mo_stop(struct ieee80211_hw *hw, bool suspend)
 {
 	struct lkpi_hw *lhw;
 
+	might_sleep();
+	lockdep_assert_wiphy(hw->wiphy);
+
 	lhw = HW_TO_LHW(hw);
 	if (lhw->ops->stop == NULL)
 		return;
@@ -197,6 +200,9 @@ lkpi_80211_mo_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vi
 	struct lkpi_hw *lhw;
 	struct lkpi_vif *lvif;
 
+	might_sleep();
+	lockdep_assert_wiphy(hw->wiphy);
+
 	lhw = HW_TO_LHW(hw);
 	if (lhw->ops->remove_interface == NULL)
 		return;