From: Tristan Madani <tristmd@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/5] wifi: rsi: fix OOB read from firmware-claimed length exceeding actual frame size
Date: Wed, 15 Apr 2026 22:23:05 +0000 [thread overview]
Message-ID: <20260415222307.1537309-4-tristmd@gmail.com> (raw)
In-Reply-To: <20260415222307.1537309-1-tristmd@gmail.com>
From: Tristan Madani <tristan@talencesecurity.com>
The firmware-controlled length field (12-bit, up to 4095) from the RX
descriptor is used as the memcpy size in rsi_prepare_skb(). No check
ensures this claimed length fits within the actual received data.
A malicious or malfunctioning firmware can cause out-of-bounds reads
past the RX buffer, leaking kernel heap contents into skbs delivered
to mac80211.
Add a bounds check in rsi_read_pkt() to reject frames where offset +
length exceeds actual_length.
Fixes: dad0d04fa7ba ("rsi: data and management rx path")
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
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 XXXXXXX..XXXXXXX 100644
--- a/drivers/net/wireless/rsi/rsi_91x_main.c
+++ b/drivers/net/wireless/rsi/rsi_91x_main.c
@@ -179,6 +179,12 @@ int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len)
queueno = rsi_get_queueno(frame_desc, offset);
length = rsi_get_length(frame_desc, offset);
+ if (offset + length > actual_length) {
+ rsi_dbg(ERR_ZONE,
+ "%s: frame overflows: offset %u + len %u > actual %u\n",
+ __func__, offset, length, actual_length);
+ goto fail;
+ }
/* Extended descriptor is valid for WLAN queues only */
if (queueno == RSI_WIFI_DATA_Q || queueno == RSI_WIFI_MGMT_Q)
extended_desc = rsi_get_extended_desc(frame_desc,
next prev parent reply other threads:[~2026-04-15 22:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 22:23 [PATCH v2 0/5] wifi: rsi: fix multiple firmware descriptor validation issues Tristan Madani
2026-04-15 22:23 ` [PATCH v2 1/5] wifi: rsi: fix OOB read from firmware offset field in SDIO RX path Tristan Madani
2026-04-15 22:23 ` [PATCH v2 2/5] wifi: rsi: fix integer underflow from firmware extended_desc in rsi_prepare_skb() Tristan Madani
2026-04-15 22:23 ` Tristan Madani [this message]
2026-04-15 22:23 ` [PATCH v2 4/5] wifi: rsi: fix OOB read from firmware pad_bytes in management RX path Tristan Madani
2026-04-15 22:23 ` [PATCH v2 5/5] wifi: rsi: fix infinite loop when firmware sends zero-length packet Tristan Madani
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=20260415222307.1537309-4-tristmd@gmail.com \
--to=tristmd@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@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