Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jul 2026 20:02:00 +0000
From:      Bjoern A. Zeeb <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 5d479b75a894 - main - LinuxKPI: 802.11: always lock around (*set_{frag,rts}_threshold)
Message-ID:  <6a5fd038.2223f.5fbc89af@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by bz:

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

commit 5d479b75a8944faeabb367d1234a9fc3fefa8df1
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-07-21 19:54:04 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-07-21 20:00:24 +0000

    LinuxKPI: 802.11: always lock around (*set_{frag,rts}_threshold)
    
    We would lock the downcalls during normal operation but not during
    vap (vif) creation as there was no need for locking.
    Add the missing locking there as drivers seem to always expect it
    (by assertion) and cannot distinguish between state.
    Add the assertions to the downcalls as we need both of them locked
    and both of them can sleep.
    
    PR:             296185 ("rtw89(4) freezes the system with INVARIANTS kernel")
    Debugged by:    Artem Bunichev (temcbun gmail.com)
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 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 355d0c160472..bf2054c5efd8 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -4522,11 +4522,13 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
 		hw->max_listen_interval = 7 * (ic->ic_lintval / ic->ic_bintval);
 	hw->conf.listen_interval = hw->max_listen_interval;
 
+	wiphy_lock(hw->wiphy);
 	/* XXX-BZ do we need to be able to update these? */
 	hw->wiphy->frag_threshold = vap->iv_fragthreshold;
 	lkpi_80211_mo_set_frag_threshold(hw, vap->iv_fragthreshold);
 	hw->wiphy->rts_threshold = vap->iv_rtsthreshold;
 	lkpi_80211_mo_set_rts_threshold(hw, vap->iv_rtsthreshold);
+	wiphy_unlock(hw->wiphy);
 	/* any others? */
 
 	/* Add per-VIF/VAP sysctls. */
diff --git a/sys/compat/linuxkpi/common/src/linux_80211_macops.c b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
index b07a2075491b..09199862dfb7 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211_macops.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
@@ -115,6 +115,9 @@ lkpi_80211_mo_set_frag_threshold(struct ieee80211_hw *hw, uint32_t frag_th)
 	struct lkpi_hw *lhw;
 	int error;
 
+	might_sleep();
+	lockdep_assert_wiphy(hw->wiphy);
+
 	lhw = HW_TO_LHW(hw);
 	if (lhw->ops->set_frag_threshold == NULL) {
 		error = EOPNOTSUPP;
@@ -135,6 +138,9 @@ lkpi_80211_mo_set_rts_threshold(struct ieee80211_hw *hw, uint32_t rts_th)
 	struct lkpi_hw *lhw;
 	int error;
 
+	might_sleep();
+	lockdep_assert_wiphy(hw->wiphy);
+
 	lhw = HW_TO_LHW(hw);
 	if (lhw->ops->set_rts_threshold == NULL) {
 		error = EOPNOTSUPP;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a5fd038.2223f.5fbc89af>