* [PATCH] wifi: brcmfmac: validate ie_offset and ie_length in BSS info
@ 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_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
^ 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: validate ie_offset and ie_length in BSS info Tanuj Sharma
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.