]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
wifi: wilc1000: validate assoc response length before subtracting header
authorHuihui Huang <hhhuang@smu.edu.sg>
Tue, 14 Jul 2026 09:17:58 +0000 (17:17 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 21 Jul 2026 11:25:06 +0000 (13:25 +0200)
commit4c4c97b60a5e978121d9ee8cb0ab3916e5d6a8de
tree8a93bece4af67d0097eceda121554db20302d2c6
parentb55a04ebb52d896cfb66716cb9b04b775d3c773f
wifi: wilc1000: validate assoc response length before subtracting header

wilc_parse_assoc_resp_info() computes the trailing IE length as

ies_len = buffer_len - sizeof(*res);

without first checking that buffer_len is at least sizeof(struct
wilc_assoc_resp) (6 bytes). buffer_len is the length reported for a
received association response (host_int_parse_assoc_resp_info() passes
hif_drv->assoc_resp / assoc_resp_info_len straight in) and must be
validated before the driver accesses the fixed header.

For a frame shorter than the 6-byte fixed header, the subtraction wraps.
For a four-byte response the result is truncated to a u16 ies_len of
65534, so kmemdup() then attempts to copy 65534 bytes starting at
buffer + sizeof(*res), beyond the valid association-response data
(CWE-125). A response shorter than four bytes can also cause an
out-of-bounds read of res->status_code at offsets 2 and 3.

Reject frames too short to hold the fixed header before touching the
header or computing ies_len. Also set the connection status to a failure
on this path: the caller falls through to a
"conn_info->status == WLAN_STATUS_SUCCESS" check after the parser
returns, so leaving the status untouched could let a malformed short
response be treated as a successful association.

Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Huihui Huang <hhhuang@smu.edu.sg>
Link: https://patch.msgid.link/20260714091811.3596126-1-hhhuang@smu.edu.sg
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/microchip/wilc1000/hif.c