diff options
| author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2026-07-21 19:54:04 +0000 |
|---|---|---|
| committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2026-07-26 16:48:40 +0000 |
| commit | 94ab8de14f0a8fd07b3f1e216ec3f42a8d51ccaf (patch) | |
| tree | fa8d9d6ac0bb694ed4bf32977aa03a8c12e6eef4 | |
| parent | 912251ac6b186aa2716ddd51bde9a0e1f6b3c2e3 (diff) | |
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
(cherry picked from commit 5d479b75a8944faeabb367d1234a9fc3fefa8df1)
| -rw-r--r-- | sys/compat/linuxkpi/common/src/linux_80211.c | 2 | ||||
| -rw-r--r-- | sys/compat/linuxkpi/common/src/linux_80211_macops.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index df6d7c3158b3..0c649bfcbc80 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -4516,11 +4516,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; |
