git: 73166d21bd83 - main - LinuxKPI: 802.11: Always lock around lkpi_80211_mo_{remove_interface,stop}()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 14 Sep 2026 19:48:16 UTC
The branch main has been updated by bz:

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

commit 73166d21bd831db264509cbdce1ab3b63ab5b189
Author:     Artem Bunichev <temcbun@gmail.com>
AuthorDate: 2026-09-13 21:21:40 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-09-14 19:06:01 +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
    MFC after:      3 days
    Differential Revision: https://reviews.freebsd.org/D59608
---
 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 ae0c374e2ea6..cde4b820b4dd 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -4622,10 +4622,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;