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: validate ie_offset and ie_length in BSS info
Date: Tue, 1 Dec 2026 02:54:32 +0530 [thread overview]
Message-ID: <20261130212432.85591-1-ertanuj96@gmail.com> (raw)
In brcmf_inform_single_bss() and brcmf_inform_ibss(), the
firmware-provided ie_offset and ie_length fields from
brcmf_bss_info_le are used to compute a pointer and length for
Information Elements without bounds checking against the BSS info
buffer size. A crafted ie_offset past the buffer end or an ie_length
exceeding the remaining space causes an out-of-bounds read passed to
cfg80211_inform_bss_data() and exposed via nl80211 scan results.
Add validation ensuring ie_offset and ie_length fall within the
BSS info buffer before using them.
Fixes: e756af5b30b0 ("brcmfmac: add e-scan support.")
Cc: stable@vger.kernel.org
Signed-off-by: Tanuj Sharma <ertanuj96@gmail.com>
---
.../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 62d072b..7573171 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -3392,6 +3392,12 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
notify_capability = le16_to_cpu(bi->capability);
notify_interval = le16_to_cpu(bi->beacon_period);
+ if (le16_to_cpu(bi->ie_offset) > le32_to_cpu(bi->length) ||
+ le32_to_cpu(bi->ie_length) >
+ le32_to_cpu(bi->length) - le16_to_cpu(bi->ie_offset)) {
+ bphy_err(drvr, "invalid ie_offset/ie_length in bss_info\n");
+ return -EINVAL;
+ }
notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
notify_ielen = le32_to_cpu(bi->ie_length);
bss_data.signal = (s16)le16_to_cpu(bi->RSSI) * 100;
@@ -3503,6 +3509,12 @@ static s32 brcmf_inform_ibss(struct brcmf_cfg80211_info *cfg,
notify_capability = le16_to_cpu(bi->capability);
notify_interval = le16_to_cpu(bi->beacon_period);
+ if (le16_to_cpu(bi->ie_offset) > le32_to_cpu(bi->length) ||
+ le32_to_cpu(bi->ie_length) >
+ le32_to_cpu(bi->length) - le16_to_cpu(bi->ie_offset)) {
+ bphy_err(drvr, "invalid ie_offset/ie_length in bss_info\n");
+ return -EINVAL;
+ }
notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
notify_ielen = le32_to_cpu(bi->ie_length);
notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100;
--
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=20261130212432.85591-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