Re: [PATCH] wifi: mm81x: validate external host table TLV lengths

From: Lachlan Hodges

Date: Thu Nov 19 2026 - 18:55:04 EST


On Sun, Nov 01, 2026 at 10:10:25PM +0800, Heyang Tan wrote:
> mm81x_fw_parse_ext_host_tbl() uses the length stored in the external host
> table payload as the TLV walk boundary. The buffer is allocated using a
> different length read from a device register, and the two values are not
> cross-checked. A device can report a small register length so that the
> driver allocates a small buffer, while the payload length field claims a
> larger size and makes the walk read beyond the allocation.
>
> Each branch also dereferences a complete fixed-size structure while only
> the start of the TLV header has been bounds-checked. A truncated trailing
> TLV can therefore make the capabilities, checksum, or YAPS parser read
> past the allocated buffer.
>
> Pass the allocation length out of mm81x_fw_read_ext_host_table() and clamp
> the payload length to it. Require a complete TLV header before reading it
> and verify that the full structure is present before dispatching it.
>
> A KASAN reproducer mirroring the TLV walk reports a slab-out-of-bounds
> with a small allocation and an oversized payload length. The same input
> does not report after these checks are applied.

There's already an existing patchset fixing this [1], please check
before sending patches.

[1] https://lore.kernel.org/linux-wireless/20260812060740.1275280-1-lilinmao@xxxxxxxxxx/T/#t

pw-bot: rejected