From: Elkin Cruz <elkin@google.com>
To: Brian Norris <briannorris@chromium.org>
Cc: Francesco Dolcini <francesco@dolcini.it>,
linux-wireless@vger.kernel.org,
Johannes Berg <johannes@sipsolutions.net>,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
irogers@google.com, Elkin Cruz <elkin@google.com>,
stable@vger.kernel.org
Subject: [PATCH wireless 2/3] wifi: mwifiex: check TLV header size in ext scan report
Date: Wed, 25 Nov 2026 21:00:37 +0000 [thread overview]
Message-ID: <20261125210038.1277960-3-elkin@google.com> (raw)
In-Reply-To: <20261125210038.1277960-1-elkin@google.com>
mwifiex_handle_event_ext_scan_report() loops while bytes_left is
non-zero and immediately dereferences tlv->header.type and
tlv->header.len (4 bytes) before checking whether bytes_left can hold a
complete struct mwifiex_ie_types_header. When 1 <= bytes_left < 4, this
reads past the end of the firmware event buffer.
Require bytes_left >= sizeof(struct mwifiex_ie_types_header) in the
outer loop condition, matching the inner TLV loop directly below.
Fixes: 21f58d200388 ("mwifiex: implement extended scan feature")
Cc: stable@vger.kernel.org
Signed-off-by: Elkin Cruz <elkin@google.com>
---
drivers/net/wireless/marvell/mwifiex/scan.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c
index bdd4b8465863..53aa16c1df33 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -2649,7 +2649,8 @@ int mwifiex_handle_event_ext_scan_report(struct mwifiex_private *priv,
tlv = (struct mwifiex_ie_types_data *)scan_resp;
- for (idx = 0; idx < num_of_set && bytes_left; idx++) {
+ for (idx = 0; idx < num_of_set &&
+ bytes_left >= sizeof(struct mwifiex_ie_types_header); idx++) {
type = le16_to_cpu(tlv->header.type);
len = le16_to_cpu(tlv->header.len);
if (bytes_left < sizeof(struct mwifiex_ie_types_header) + len) {
--
2.56.1.839.g22a8290db9-goog
next prev parent reply other threads:[~2026-11-25 21:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 21:00 [PATCH wireless 0/3] wifi: mwifiex: fix UAF and ext scan TLV bounds checks Elkin Cruz
2026-11-25 21:00 ` [PATCH wireless 1/3] wifi: mwifiex: fix UAF after skb_realloc_headroom() in bridged RX Elkin Cruz
2026-11-25 21:00 ` Elkin Cruz [this message]
2026-11-25 21:00 ` [PATCH wireless 3/3] wifi: mwifiex: validate ext scan event envelope and TLV lengths Elkin Cruz
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=20261125210038.1277960-3-elkin@google.com \
--to=elkin@google.com \
--cc=briannorris@chromium.org \
--cc=francesco@dolcini.it \
--cc=irogers@google.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--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
all inboxes | Powered by JetHome®