From: Maoyi Xie <maoyixie.tju@gmail.com>
To: Brian Norris <briannorris@chromium.org>
Cc: Francesco Dolcini <francesco@dolcini.it>,
linux-wireless@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH wireless] wifi: mwifiex: bound the RX reorder index by the window size
Date: Mon, 23 Nov 2026 21:04:34 +0800 [thread overview]
Message-ID: <20261123130434.2841777-1-maoyixie.tju@gmail.com> (raw)
mwifiex_11n_rx_reorder_pkt() reads and writes
tbl->rx_reorder_ptr[pkt_index] without checking pkt_index against
win_size. seq_num is a 16-bit field of the RX descriptor from the
device. If the window wraps past 4095, a seq_num above 4095 can pass
the window checks and give an index far past the array. With a one-slot
window, which a firmware BT coexistence event can set, every accepted
seq_num other than start_win indexes past the slot. A single lost or
reordered frame gives such a seq_num.
Drop a frame whose index is past the array, as for an occupied slot.
Found with a CodeQL-based static analysis tool that we are developing.
Both cases reproduce in a userspace harness under AddressSanitizer,
which reports nothing with this patch. Not tested on hardware.
Compile-tested with W=1 on next-20261116.
Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")
Fixes: d219b7eb3792 ("mwifiex: handle BT coex event to adjust Rx BA window size")
Cc: stable@vger.kernel.org
Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
---
I used an LLM to help write the harness and this patch.
nxpwifi has the same code. A patch that adds the same check there is
marked accepted in patchwork.
https://lore.kernel.org/linux-wireless/20261119095214.186808-1-guohongyu@cmss.chinamobile.com/
drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
index 06b005525078411..54fb52be963aadd 100644
--- a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
@@ -616,6 +616,11 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv,
else
pkt_index = (seq_num+MAX_TID_VALUE) - start_win;
+ if (pkt_index >= win_size) {
+ ret = -1;
+ goto done;
+ }
+
if (tbl->rx_reorder_ptr[pkt_index]) {
ret = -1;
goto done;
base-commit: 7e1392a42ea288d70a266f6553fe06f57f8647ea
--
2.34.1
reply other threads:[~2026-11-23 13:04 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=20261123130434.2841777-1-maoyixie.tju@gmail.com \
--to=maoyixie.tju@gmail.com \
--cc=briannorris@chromium.org \
--cc=francesco@dolcini.it \
--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