From: Tanuj Sharma <ertanuj96@gmail.com>
To: arend.vanspriel@broadcom.com
Cc: kvalo@kernel.org, linux-wireless@vger.kernel.org,
brcm80211@lists.linux.dev, stable@vger.kernel.org
Subject: [PATCH] wifi: brcmfmac: clamp SSID_len to IEEE80211_MAX_SSID_LEN in BSS comparison
Date: Tue, 1 Dec 2026 02:54:46 +0530 [thread overview]
Message-ID: <20261130212446.85622-1-ertanuj96@gmail.com> (raw)
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
reply other threads:[~2026-11-30 21:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130212446.85622-1-ertanuj96@gmail.com \
--to=ertanuj96@gmail.com \
--cc=arend.vanspriel@broadcom.com \
--cc=brcm80211@lists.linux.dev \
--cc=kvalo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox