Re: [PATCH v2 2/2] wifi: mm81x: bound disabled-channel loop to the allocated response

From: Lachlan Hodges

Date: Mon Nov 23 2026 - 18:41:07 EST


On Fri, Nov 20, 2026 at 02:49:05PM +0800, guohongyu wrote:
> mm81x_mac_check_fw_disabled_chans() allocates a response buffer sized
> for ARRAY_SIZE(mors_s1ghz_channels) (26) channel entries plus the
> fixed header, but then iterates the entries with the firmware-provided
> count alone:
>
> for (i = 0; i < le32_to_cpu(resp->n_channels); i++) {
> struct host_cmd_disabled_channel_entry *entry =
> &resp->channels[i];
>
> n_channels is a __le32 filled by the firmware response and is not
> validated against the buffer size in any way. A firmware that reports
> more than 26 channels makes the loop read past the end of the
> kzalloc()ed buffer into adjacent heap memory and interpret it as
> channel entries.
>
> Bound the loop to the number of entries the buffer was actually
> allocated for.
>
> Fixes: b1906cea00b0 ("wifi: mm81x: add mm81x Wi-Fi HaLow driver")
> Signed-off-by: guohongyu <guohongyu@xxxxxxxxxxxxxxxxxxxx>

Same as other patch, this has been fixed ad130fe51691 ("wifi: mm81x:
validate n_channels in disabled channels response").

pw-bot: rejected