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,
Tristan Madani <tristan@talencesecurity.com>
Subject: [PATCH v3 1/2] wifi: wilc1000: fix integer underflow in wilc_network_info_received()
Date: Tue, 21 Apr 2026 13:50:00 +0000 [thread overview]
Message-ID: <20260421135001.343596-2-tristmd@gmail.com> (raw)
In-Reply-To: <20260421135001.343596-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>
---
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/microchip/wilc1000/hif.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c
index 009c4770a6f95..473e406c98d87 100644
--- a/drivers/net/wireless/microchip/wilc1000/hif.c
+++ b/drivers/net/wireless/microchip/wilc1000/hif.c
@@ -1576,6 +1576,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]);
@@ -1594,7 +1595,15 @@ 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,
--
2.47.3
next prev parent reply other threads:[~2026-04-21 13:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 13:49 [PATCH v3 0/2] wifi: wilc1000: firmware trust boundary hardening Tristan Madani
2026-04-21 13:50 ` Tristan Madani [this message]
2026-04-22 21:26 ` [PATCH v3 1/2] wifi: wilc1000: fix integer underflow in wilc_network_info_received() Johannes Berg
2026-04-21 13:50 ` [PATCH v3 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=20260421135001.343596-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 \
--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