Re: [PATCH] wifi: brcmfmac: bound NVRAM comment parsing
From: Arend van Spriel
Date: Mon Sep 14 2026 - 16:03:48 EST
On Sun, 30 Aug 2026 21:53:28 +0800, Pengpeng Hou wrote:
> The NVRAM parser tracks a length-bounded firmware blob but its comment
> handler uses unbounded strchr() calls. A comment without a newline or NUL
> inside the remaining blob can make the search read beyond the current
> input.
>
> Store the bounded input length and use memchr() for comment terminators.
Please add:
Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 3e99b08ab53c ("brcmfmac: enhance nvram processing")
> Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
[...]
> @@ -215,6 +220,7 @@ static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
> size = BRCMF_FW_MAX_NVRAM_SIZE;
> else
> size = data_len;
> + nvp->data_len = size;
> /* Add space for properties we may add */
> size += strlen(BRCMF_FW_DEFAULT_BOARDREV) + 1;
> size += BRCMF_FW_MACADDR_LEN + 1;
size is capped at BRCMF_FW_MAX_NVRAM_SIZE to allocate the output buffer,
as some NVRAM files can be larger than 64KB due to comments. Setting
nvp->data_len to size will prematurely truncate parsing of those files.
This should be:
nvp->data_len = data_len;
Regards,
Arend