From: Tristan Madani <tristmd@gmail.com>
To: Ajay Singh <ajay.kathat@microchip.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: Johannes Berg <johannes@sipsolutions.net>,
linux-wireless@vger.kernel.org
Subject: [PATCH v2 1/2] wifi: wilc1000: fix integer underflow in wilc_network_info_received()
Date: Wed, 15 Apr 2026 22:24:16 +0000 [thread overview]
Message-ID: <20260415222418.1543832-2-tristmd@gmail.com> (raw)
In-Reply-To: <20260415222418.1543832-1-tristmd@gmail.com>
From: Tristan Madani <tristan@talencesecurity.com>
The firmware-controlled frame length at buffer[6..7] is decremented by 1
and used as the kmemdup size without validating the value. When the
firmware sends 0, the u16 subtraction wraps to 65535, causing a 64KB
out-of-bounds read from the RX buffer. For non-zero but inflated values,
the read exceeds the actual packet data.
Add validation that the frame length is at least 1 and fits within the
available buffer.
Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
drivers/net/wireless/microchip/wilc1000/hif.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c
index XXXXXXX..XXXXXXX 100644
--- a/drivers/net/wireless/microchip/wilc1000/hif.c
+++ b/drivers/net/wireless/microchip/wilc1000/hif.c
@@ -1572,6 +1572,7 @@ void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length)
struct wilc_vif *vif;
int srcu_idx;
int result;
+ u16 frame_len;
int id;
id = get_unaligned_le32(&buffer[length - 4]);
@@ -1595,7 +1596,14 @@ void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length)
if (IS_ERR(msg))
goto out;
- msg->body.net_info.frame_len = get_unaligned_le16(&buffer[6]) - 1;
+ frame_len = get_unaligned_le16(&buffer[6]);
+ if (frame_len == 0 || frame_len > length - 9) {
+ netdev_err(vif->ndev,
+ "%s: invalid frame_len %u (buffer %u)\n",
+ __func__, frame_len, length);
+ kfree(msg);
+ goto out;
+ }
+ msg->body.net_info.frame_len = frame_len - 1;
msg->body.net_info.rssi = buffer[8];
msg->body.net_info.mgmt = kmemdup(&buffer[9],
msg->body.net_info.frame_len,
next prev parent reply other threads:[~2026-04-15 22:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 22:24 [PATCH v2 0/2] wifi: wilc1000: fix integer underflow and OOB read from firmware packets Tristan Madani
2026-04-15 22:24 ` Tristan Madani [this message]
2026-04-15 22:24 ` [PATCH v2 2/2] wifi: wilc1000: fix OOB read from firmware RX packet header fields 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=20260415222418.1543832-2-tristmd@gmail.com \
--to=tristmd@gmail.com \
--cc=ajay.kathat@microchip.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=johannes@sipsolutions.net \
--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