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 4/5] wifi: rsi: fix OOB read from firmware pad_bytes in management RX path
Date: Wed, 15 Apr 2026 22:23:06 +0000 [thread overview]
Message-ID: <20260415222307.1537309-5-tristmd@gmail.com> (raw)
In-Reply-To: <20260415222307.1537309-1-tristmd@gmail.com>
From: Tristan Madani <tristan@talencesecurity.com>
The firmware-controlled pad_bytes value (u8, from descriptor byte 4) is
used to shift the skb_put_data() source pointer forward in
rsi_mgmt_pkt_to_core(). While the existing msg_len -= pad_bytes check
catches the case where pad_bytes >= msg_len, it does not prevent a large
pad_bytes from shifting the read window into heap memory beyond the
actual packet data. The resulting kernel heap contents are delivered to
mac80211 as a management frame.
Add validation that pad_bytes does not exceed half of msg_len. Alignment
padding in 802.11 management frames is typically 0-3 bytes, so any
value exceeding msg_len / 2 indicates a corrupted descriptor.
Fixes: dad0d04fa7ba ("rsi: Add RS9113 wireless driver")
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
drivers/net/wireless/rsi/rsi_91x_mgmt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
index XXXXXXX..XXXXXXX 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
@@ -490,6 +490,12 @@ static int rsi_mgmt_pkt_to_core(struct rsi_common *common,
u8 pad_bytes = msg[4];
struct sk_buff *skb;
+ if (pad_bytes > msg_len / 2) {
+ rsi_dbg(MGMT_RX_ZONE,
+ "%s: pad_bytes %u too large for msg_len %d\n",
+ __func__, pad_bytes, msg_len);
+ return -EINVAL;
+ }
if (!adapter->sc_nvifs)
return -ENOLINK;
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 ` [PATCH v2 3/5] wifi: rsi: fix OOB read from firmware-claimed length exceeding actual frame size Tristan Madani
2026-04-15 22:23 ` Tristan Madani [this message]
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-5-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