From: Tristan Madani <tristmd@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Tristan Madani <tristan@talencesecurity.com>
Subject: [PATCH v3 5/5] wifi: rsi: fix OOB read from firmware offset field in SDIO RX path
Date: Tue, 21 Apr 2026 13:49:16 +0000 [thread overview]
Message-ID: <20260421134916.317971-6-tristmd@gmail.com> (raw)
In-Reply-To: <20260421134916.317971-1-tristmd@gmail.com>
From: Tristan Madani <tristan@talencesecurity.com>
The firmware-controlled offset field in rsi_read_pkt() is validated only
when rcv_pkt_len is zero (USB path). For the SDIO path, rcv_pkt_len is
always positive, so the check is skipped entirely. A crafted offset can
cause out-of-bounds reads past the 8192-byte pktbuffer when computing
queue number, length, extended descriptor, and data pointers.
Add a transport-independent bounds check to reject offset values that
exceed the frame's actual_length.
Fixes: dad0d04fa7ba ("rsi: data and management rx path")
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
Changes in v3:
- Regenerated from wireless-next with proper git format-patch.
Changes in v2:
- New patch in v2, not present in v1.
drivers/net/wireless/rsi/rsi_91x_main.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c
index eb950e862ecf1..bc03066a240c1 100644
--- a/drivers/net/wireless/rsi/rsi_91x_main.c
+++ b/drivers/net/wireless/rsi/rsi_91x_main.c
@@ -180,6 +180,12 @@ int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len)
if (!rcv_pkt_len && offset >
RSI_MAX_RX_USB_PKT_SIZE - FRAME_DESC_SZ)
goto fail;
+ if (offset > actual_length) {
+ rsi_dbg(ERR_ZONE,
+ "%s: offset %u exceeds length %u\n",
+ __func__, offset, actual_length);
+ goto fail;
+ }
queueno = rsi_get_queueno(frame_desc, offset);
length = rsi_get_length(frame_desc, offset);
--
2.47.3
prev parent reply other threads:[~2026-04-21 13:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 13:49 [PATCH v3 0/5] wifi: rsi: firmware trust boundary hardening Tristan Madani
2026-04-21 13:49 ` [PATCH v3 1/5] wifi: rsi: fix integer underflow from firmware extended_desc in rsi_prepare_skb() Tristan Madani
2026-04-21 13:49 ` [PATCH v3 2/5] wifi: rsi: fix OOB read from firmware-claimed length exceeding actual frame size Tristan Madani
2026-04-21 13:49 ` [PATCH v3 3/5] wifi: rsi: fix OOB read from firmware pad_bytes in management RX path Tristan Madani
2026-04-21 13:49 ` Tristan Madani [this message]
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=20260421134916.317971-6-tristmd@gmail.com \
--to=tristmd@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=tristan@talencesecurity.com \
/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