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 1/5] wifi: rsi: fix integer underflow from firmware extended_desc in rsi_prepare_skb()
Date: Tue, 21 Apr 2026 13:49:12 +0000 [thread overview]
Message-ID: <20260421134916.317971-2-tristmd@gmail.com> (raw)
In-Reply-To: <20260421134916.317971-1-tristmd@gmail.com>
From: Tristan Madani <tristan@talencesecurity.com>
The firmware-controlled extended_desc value is subtracted from pkt_len
without bounds checking. When extended_desc exceeds pkt_len, the u32
subtraction wraps, causing either a failed allocation (DoS) or an
out-of-bounds heap read via the subsequent memcpy from buffer +
payload_offset. Both SDIO and USB paths are affected.
Add a bounds check to reject packets where extended_desc exceeds
pkt_len.
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 to
produce valid index hashes (v2 had post-processed index lines).
Changes in v2:
- No code changes from v1.
drivers/net/wireless/rsi/rsi_91x_main.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c
index 662e42d1e5e8d..2ff7068bad7a7 100644
--- a/drivers/net/wireless/rsi/rsi_91x_main.c
+++ b/drivers/net/wireless/rsi/rsi_91x_main.c
@@ -134,6 +134,11 @@ static struct sk_buff *rsi_prepare_skb(struct rsi_common *common,
pkt_len = RSI_RCV_BUFFER_LEN * 4;
}
+ if (extended_desc > pkt_len) {
+ rsi_dbg(ERR_ZONE, "%s: extended_desc %u > pkt_len %u\n",
+ __func__, extended_desc, pkt_len);
+ return NULL;
+ }
pkt_len -= extended_desc;
skb = dev_alloc_skb(pkt_len + FRAME_DESC_SZ);
if (skb == NULL)
--
2.47.3
next 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 ` Tristan Madani [this message]
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 ` [PATCH v3 5/5] wifi: rsi: fix OOB read from firmware offset field in SDIO " 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=20260421134916.317971-2-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