git: 1a083d59b61a - stable/14 - net80211: HT: check for feature support in ht_recv_action_ht_txchwidth()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 10 Feb 2025 14:52:41 UTC
The branch stable/14 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=1a083d59b61a687c865f16b9bba4820e820bde2a

commit 1a083d59b61a687c865f16b9bba4820e820bde2a
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-12-01 20:16:19 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-02-10 14:52:09 +0000

    net80211: HT: check for feature support in ht_recv_action_ht_txchwidth()
    
    ht_recv_action_ht_txchwidth() can blindly change the channel width to
    40 Mhz whether or not that is supported.  If 20/40 is not supported
    there is nothing to do as the channel width cannot change in that case.
    
    While here mark unused arguments with __unused.
    
    Sponosred by:   The FreeBSD Foundation
    Reviewed by:    adrian
    Differential Revision: https://reviews.freebsd.org/D47857
    
    (cherry picked from commit 30e8252353d95cc77f787ef784942a551d3e0567)
---
 sys/net80211/ieee80211_ht.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c
index 5da404a92120..e7b3afe17fdc 100644
--- a/sys/net80211/ieee80211_ht.c
+++ b/sys/net80211/ieee80211_ht.c
@@ -2599,11 +2599,15 @@ ht_recv_action_ba_delba(struct ieee80211_node *ni,
 
 static int
 ht_recv_action_ht_txchwidth(struct ieee80211_node *ni,
-	const struct ieee80211_frame *wh,
-	const uint8_t *frm, const uint8_t *efrm)
+	const struct ieee80211_frame *wh __unused,
+	const uint8_t *frm, const uint8_t *efrm __unused)
 {
 	int chw;
 
+	/* If 20/40 is not supported the chw cannot change. */
+	if ((ni->ni_htcap & IEEE80211_HTCAP_CHWIDTH40) == 0)
+		return (0);
+
 	chw = (frm[2] == IEEE80211_A_HT_TXCHWIDTH_2040) ?
 	    IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20;