Re: [PATCH v2 1/2] wifi: mm81x: clamp command-response copy to the received skb length
From: Lachlan Hodges
Date: Mon Nov 23 2026 - 18:37:36 EST
On Fri, Nov 20, 2026 at 02:49:04PM +0800, guohongyu wrote:
> mm81x_cmd_resp_process() copies a synchronous command response from
> the received skb into the caller-provided buffer:
>
> length = min_t(int, length,
> le16_to_cpu(src_resp->hdr.len) +
> sizeof(struct host_cmd_header));
> memcpy(dest_resp, src_resp, length);
>
> src_resp->hdr.len is the inner host_cmd_header length of the firmware
> response. The skb, however, was sized by the *outer* mm81x_skb_hdr.len
> (mm81x_yaps_read_pkt(), yaps.c:186-199: skb_len = sizeof(*hdr) +
> hdr->offset + le16_to_cpu(hdr->len); skb_trim(skb, skb_len)), and
> nothing ties the inner header length to the outer one. A buggy or
> malicious firmware can therefore declare an inner hdr.len far larger
> than the payload actually present, and the memcpy reads past the end of
> the skb's data into adjacent heap memory, leaking it into the command
> response buffer.
>
> Clamp the copy to skb->len so we never read past the data actually
> received.
>
> Fixes: b1906cea00b0 ("wifi: mm81x: add mm81x Wi-Fi HaLow driver")
> Signed-off-by: guohongyu <guohongyu@xxxxxxxxxxxxxxxxxxxx>
This has already been fixed by cd4335a9a41f ("validate response length
in mm81x_cmd_resp_process()"). Make sure you base your work on the
mm81x-next tree [1] (or -current).
[1] https://github.com/MorseMicro/linux-wireless
pw-bot: rejected