The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=5d1d86b3dd4dfc48d14c5af74270a97a26d71a95
commit 5d1d86b3dd4dfc48d14c5af74270a97a26d71a95 Author: Bjoern A. Zeeb <b...@freebsd.org> AuthorDate: 2025-05-27 19:33:13 +0000 Commit: Bjoern A. Zeeb <b...@freebsd.org> CommitDate: 2025-06-10 23:38:18 +0000 LinuxKPI: 802.11: make synching from HT more resilient During testing I hit a case where htcap->mcs.rx_mask[0,1] were zero. This should not happen as that would mean we are not supporting HT. After adding extra caution for debugging I could no longer reproduce the case. So just to deal with the eventuality make synching from HT more resilient by checking that we have nss > 0 or otherwise disable HT operations. Move setting the bandwidth below this check to not alter it in case of the now early return. Sponsored by: The FreeBSD Foundation (cherry picked from commit 58dae28f665b32650f452730378693de40e96d68) --- sys/compat/linuxkpi/common/src/linux_80211.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index ffa1c1f23339..6e65b49fb81b 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -482,12 +482,6 @@ lkpi_sta_sync_ht_from_ni(struct ieee80211_vif *vif, struct ieee80211_sta *sta, sta->deflink.ht_cap.cap = htcap->cap_info; sta->deflink.ht_cap.mcs = htcap->mcs; - if ((sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) != 0 && - IEEE80211_IS_CHAN_HT40(ni->ni_chan)) - sta->deflink.bandwidth = IEEE80211_STA_RX_BW_40; - else - sta->deflink.bandwidth = IEEE80211_STA_RX_BW_20; - /* * 802.11n-2009 20.6 Parameters for HT MCSs gives the mandatory/ * optional MCS for Nss=1..4. We need to check the first four @@ -496,11 +490,21 @@ lkpi_sta_sync_ht_from_ni(struct ieee80211_vif *vif, struct ieee80211_sta *sta, */ rx_nss = 0; for (i = 0; i < 4; i++) { - if (htcap->mcs.rx_mask[i]) + if (htcap->mcs.rx_mask[i] != 0) rx_nss++; } - if (rx_nss > 0) + if (rx_nss > 0) { sta->deflink.rx_nss = rx_nss; + } else { + sta->deflink.ht_cap.ht_supported = false; + return; + } + + if ((sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) != 0 && + IEEE80211_IS_CHAN_HT40(ni->ni_chan)) + sta->deflink.bandwidth = IEEE80211_STA_RX_BW_40; + else + sta->deflink.bandwidth = IEEE80211_STA_RX_BW_20; IMPROVE("sta->wme");