The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f51c794cbc80682931d47264e3c18329bae0a2c1
commit f51c794cbc80682931d47264e3c18329bae0a2c1 Author: Bjoern A. Zeeb <b...@freebsd.org> AuthorDate: 2025-06-18 21:58:20 +0000 Commit: Bjoern A. Zeeb <b...@freebsd.org> CommitDate: 2025-06-19 01:23:12 +0000 net80211: in ieee80211_sta_join() only do_ht if HT is avail In ieee80211_sta_join() there are currently two ways to set "do_ht": (1) after checking HT IEs are avail, and (2) after checking VHT IEs are avail and we are not on 2GHz. In the latter case no one checks that HT IEs are available and when we hit ieee80211_ht_updateparams_final() htinfo may be NULL and we panic. Avoid this by only checking for VHT if do_ht was set. No VHT without HT IEs. While here switch do_ht to be a bool. Sponsored by: The FreeBSD Foundation MFC after: 3 days PR: 287625 Fixes: 51172f62a753f Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D50923 --- sys/net80211/ieee80211_node.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index de19bc6a7361..ad17af6778a1 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -940,7 +940,7 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node *ni; - int do_ht = 0; + bool do_ht; ni = ieee80211_alloc_node(&ic->ic_sta, vap, se->se_macaddr, __func__, __LINE__); @@ -1016,6 +1016,7 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, * association request/response, the only appropriate place * to setup the HT state is here. */ + do_ht = false; if (ni->ni_ies.htinfo_ie != NULL && ni->ni_ies.htcap_ie != NULL && vap->iv_flags_ht & IEEE80211_FHT_HT) { @@ -1023,7 +1024,7 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, ieee80211_ht_updateparams(ni, ni->ni_ies.htcap_ie, ni->ni_ies.htinfo_ie); - do_ht = 1; + do_ht = true; } /* @@ -1032,7 +1033,7 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, * * For now, don't allow 2GHz VHT operation. */ - if (ni->ni_ies.vhtopmode_ie != NULL && + if (do_ht && ni->ni_ies.vhtopmode_ie != NULL && ni->ni_ies.vhtcap_ie != NULL && vap->iv_vht_flags & IEEE80211_FVHT_VHT) { if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) { @@ -1045,7 +1046,6 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, ni->ni_ies.vhtcap_ie, ni->ni_ies.vhtopmode_ie); ieee80211_setup_vht_rates(ni); - do_ht = 1; } }