Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] wifi: brcmfmac: clamp SSID_len to IEEE80211_MAX_SSID_LEN in BSS comparison
@ 2026-11-30 21:24 Tanuj Sharma
  0 siblings, 0 replies; only message in thread
From: Tanuj Sharma @ 2026-11-30 21:24 UTC (permalink / raw)
  To: arend.vanspriel; +Cc: kvalo, linux-wireless, brcm80211, stable

In brcmf_compare_update_same_bss(), the firmware-provided SSID_len
field (u8, range 0-255) is used as the length argument to memcmp on
the 32-byte SSID buffer without validation. When SSID_len exceeds
IEEE80211_MAX_SSID_LEN (32), memcmp reads up to 223 bytes past the
SSID buffer from both the incoming BSS info and the cached BSS entry.

Add a check rejecting BSS entries where either SSID_len exceeds
IEEE80211_MAX_SSID_LEN.

Fixes: 89286dc94520 ("brcmfmac: Update connect setup/handling routines for multiple bss.")
Cc: stable@vger.kernel.org
Signed-off-by: Tanuj Sharma <ertanuj96@gmail.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 7573171..fd09c27 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -3619,6 +3619,10 @@ brcmf_compare_update_same_bss(struct brcmf_cfg80211_info *cfg,
 	ch_bss_info_le.chspec = le16_to_cpu(bss_info_le->chanspec);
 	cfg->d11inf.decchspec(&ch_bss_info_le);
 
+	if (bss_info_le->SSID_len > IEEE80211_MAX_SSID_LEN ||
+	    bss->SSID_len > IEEE80211_MAX_SSID_LEN)
+		return false;
+
 	if (!memcmp(&bss_info_le->BSSID, &bss->BSSID, ETH_ALEN) &&
 		ch_bss.band == ch_bss_info_le.band &&
 		bss_info_le->SSID_len == bss->SSID_len &&
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-30 21:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 21:24 [PATCH] wifi: brcmfmac: clamp SSID_len to IEEE80211_MAX_SSID_LEN in BSS comparison Tanuj Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox