From: sashiko-bot@kernel.org
To: "Alessio Ferri" <alessio.ferri@mythread.it>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 2/4] bcma: allow SHIM-style mini-EROM wrapper-less cores in scan
Date: Fri, 29 May 2026 01:25:00 +0000 [thread overview]
Message-ID: <20260529012501.1AF511F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260529-add-bcm6362-wlan-v1-2-722242777f58@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Unconditional dereference of `cc->core` in dependent modules can cause a kernel Oops if core scanning fails or a core is missing.
- [High] The fallback bridge check in `bcma_get_next_core()` fails to skip the rest of the component's EROM descriptors before returning `-ENXIO`.
--
commit 257794fc3cb2f2e7a20011d91e6239f7a6956709
Author: Alessio Ferri <alessio.ferri@mythread.it>
bcma: allow SHIM-style mini-EROM wrapper-less cores in scan
This commit modifies bcma_get_next_core() to allow certain wrapper-less
components on systems with a specific mini-erom layout. It resolves a
silent failure where skipped components lead to an empty core list,
eventually causing a null pointer dereference during probe.
> On SoCs that publish a SHIM-style mini-EROM (i.e. BCM6362) the
> WLAN backplane lists three components:
> ChipCommon, IEEE 802.11 and BCMA_CORE_SHIM. None of the three is
> in the existing allowlist, so all three are skipped silently,
> bus->cores stays empty, bcma_find_core(BCMA_CORE_CHIPCOMMON)
> returns NULL, and a later bcma_chipco_watchdog_register()
> dereferences cc->core->bus on its first line and oopses mid-probe.
[Severity: High]
This is a pre-existing issue, but does fixing this specific edge case
leave an underlying structural fragility unhandled?
If a hardware variant genuinely lacks a ChipCommon core or its erom is
malformed, bcma_find_core() returns null and bus->drv_cc.core remains null.
Subsequently, bcma_register_devices() calls bcma_gpio_init() and
bcma_chipco_watchdog_register(). Both of these helper functions
unconditionally dereference cc->core->bus on their first line without
checking if cc->core is valid.
This would trigger a null pointer dereference and a kernel oops mid-probe.
Since the bus can be exposed over hotpluggable pci interfaces, could a
malformed or malicious untrusted device intentionally trigger this local
denial of service?
> diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
> index 983a62ddeebb0..782fc53eb6b3c 100644
> --- a/drivers/bcma/scan.c
> +++ b/drivers/bcma/scan.c
> @@ -318,6 +318,21 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
> case BCMA_CORE_GCI:
> /* Not used yet: case BCMA_CORE_OOB_ROUTER: */
> break;
> + case BCMA_CORE_CHIPCOMMON:
> + case BCMA_CORE_80211:
> + case BCMA_CORE_SHIM:
[Severity: High]
This isn't a bug introduced by this patch, but does the fallback bridge
check later in bcma_get_next_core() fail to skip the rest of the component's
descriptors before returning -ENXIO?
If a bridge component has master ports, the early bcma_erom_is_bridge()
check returns false. Later, when bcma_erom_get_addr_desc() identifies a
SCAN_ADDR_TYPE_BRIDGE descriptor, it logs "Bridge found" and returns -ENXIO:
drivers/bcma/scan.c:bcma_get_next_core() {
...
/* Try again to see if it is a bridge */
tmp = bcma_erom_get_addr_desc(bus, eromptr,
SCAN_ADDR_TYPE_BRIDGE, 0);
if (tmp == 0 || IS_ERR_VALUE_U32(tmp)) {
return -EILSEQ;
} else {
bcma_info(bus, "Bridge found\n");
return -ENXIO;
}
...
}
Crucially, unlike other -ENXIO error paths, it omits calling
bcma_erom_skip_component(bus, eromptr).
If the bridge component has remaining descriptors like additional slave ports
or wrappers, eromptr is left misaligned mid-component. On the subsequent
iteration of the scan loop in bcma_bus_scan(), the parser would expect a
component identifier but encounter a leftover wrapper or port descriptor
instead.
Could this result in an -EILSEQ error that prematurely aborts the entire
bus initialization?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260529-add-bcm6362-wlan-v1-0-722242777f58@gmail.com?part=2
next prev parent reply other threads:[~2026-05-29 1:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 0:05 [PATCH 0/4] bcma: support SHIM-attached big-endian SoC backplanes (BCM6362) Alessio Ferri
2026-05-29 0:05 ` [PATCH 1/4] bcma: support driver specific quirks from soc pdata Alessio Ferri
2026-05-29 0:48 ` sashiko-bot
2026-05-29 0:06 ` [PATCH 2/4] bcma: allow SHIM-style mini-EROM wrapper-less cores in scan Alessio Ferri
2026-05-29 1:25 ` sashiko-bot [this message]
2026-05-29 0:06 ` [PATCH 3/4] dt-bindings: bus: add brcm,bcm6362-wlan Alessio Ferri
2026-05-29 1:36 ` sashiko-bot
2026-05-29 0:06 ` [PATCH 4/4] bus: add BCM6362 on-chip WLAN SHIM bridge driver Alessio Ferri
2026-05-29 2:02 ` sashiko-bot
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=20260529012501.1AF511F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alessio.ferri@mythread.it \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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