From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: Soeren Coremans <sorencoremans@gmail.com>
Cc: linux-wireless@vger.kernel.org, arend.vanspriel@broadcom.com,
brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com
Subject: Re: [PATCH wireless-next 2/3] wifi: brcmfmac: pcie: bound memdump to the mapped TCM window
Date: Thu, 26 Nov 2026 15:29:32 +0100 [thread overview]
Message-ID: <20261126142933.875175-3-arend.vanspriel@broadcom.com> (raw)
In-Reply-To: <20261105215954.184290-3-sorencoremans@gmail.com>
On Thu, 5 Nov 2026 22:59:53 +0100, Soeren Coremans <sorencoremans@gmail.com> wrote:
> brcmf_chip_get_raminfo() reports "RAM size is incorrect" on a dead
> device but leaves the bogus value in ci->ramsize. A following
> brcmf_fw_crashed() then dumps that many bytes from the TCM mapping,
> which is only as large as BAR2, and faults in ioread32():
>
> memdump 0x00200000+15728640 exceeds TCM window 0x800000
>
> Remember the BAR2 size and refuse dumps that do not fit. Only builds
> with CONFIG_BRCMDBG create the memdump, so only they are affected.
>
> Found and written with the help of an AI coding assistant (Claude Opus
> 5.5); the cover letter describes how.
>
> Fixes: ff4445a8502c ("brcmfmac: expose device memory to devcoredump subsystem")
> Signed-off-by: Soeren Coremans <sorencoremans@gmail.com>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
[...]
> @@ -1669,6 +1670,12 @@ static int brcmf_pcie_get_memdump(struct device *dev, void *data, size_t len)
> struct brcmf_pciedev_info *devinfo = buspub->devinfo;
>
> brcmf_dbg(PCIE, "dump at 0x%08X: len=%zu\n", devinfo->ci->rambase, len);
> + if (devinfo->ci->rambase > devinfo->tcm_size ||
> + len > devinfo->tcm_size - devinfo->ci->rambase) {
> + brcmf_err(bus_if, "memdump 0x%08X+%zu exceeds TCM window %pa\n",
> + devinfo->ci->rambase, len, &devinfo->tcm_size);
> + return -EINVAL;
> + }
> brcmf_pcie_copy_dev_tomem(devinfo, devinfo->ci->rambase, data, len);
> return 0;
> }
The bogus size is left in ci->ramsize because brcmf_chip_get_raminfo() does
not clear it when it returns -EINVAL for "RAM size is incorrect". Clearing it
there would fix the source for every get_ramsize() user. The check here is
fine as a safeguard though. You may add my acknowledgement in v2.
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Regards,
Arend
next prev parent reply other threads:[~2026-11-26 14:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 21:59 [PATCH wireless-next 0/3] wifi: brcmfmac: pcie: recover from fatal PCIe errors Soeren Coremans
2026-11-05 21:59 ` [PATCH wireless-next 1/3] wifi: brcmfmac: pcie: stop console read on invalid write index Soeren Coremans
2026-11-26 14:29 ` Arend van Spriel
2026-11-05 21:59 ` [PATCH wireless-next 2/3] wifi: brcmfmac: pcie: bound memdump to the mapped TCM window Soeren Coremans
2026-11-26 14:29 ` Arend van Spriel [this message]
2026-11-05 21:59 ` [PATCH wireless-next 3/3] wifi: brcmfmac: pcie: recover from fatal PCIe errors Soeren Coremans
2026-11-26 14:29 ` Arend van Spriel
2026-11-26 14:29 ` [PATCH wireless-next 0/3] " Arend van Spriel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126142933.875175-3-arend.vanspriel@broadcom.com \
--to=arend.vanspriel@broadcom.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=brcm80211@lists.linux.dev \
--cc=linux-wireless@vger.kernel.org \
--cc=sorencoremans@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox