From: sashiko-bot@kernel.org
To: "Jim Quinlan" <james.quinlan@broadcom.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH 10/13] PCI: brcmstb: Declare and assign quirk PERST_PCIE_REV_CUTOFF
Date: Fri, 11 Sep 2026 23:49:12 +0000 [thread overview]
Message-ID: <20260911234913.470DE1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260911233541.1650895-11-james.quinlan@broadcom.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Use-After-Free / NULL pointer dereference in error path when pci_host_probe() fails.
- [High] Use of uninitialized spinlock `pcie->bridge_lock`.
--
commit 8a2eb9e850a817eb0d5eb7cbe7b4bf1dbe6785e6
Author: Jim Quinlan <james.quinlan@broadcom.com>
PCI: brcmstb: Declare and assign quirk PERST_PCIE_REV_CUTOFF
This commit declares a new quirk for SoCs where the SW behavior for asserting
PERST# only works up to a specific PCIe HW version, and assigns it to the
bcm4908 configuration.
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index dfd7035710918..047783e33ae42 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
[ ... ]
> @@ -2168,7 +2171,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
> goto fail;
>
> pcie->hw_rev = readl(pcie->base + PCIE_MISC_REVISION);
> - if (pcie->cfg->soc_base == BCM4908 &&
> + if (BQUIRK(pcie, PERST_PCIE_REV_CUTOFF) &&
> pcie->hw_rev >= BRCM_PCIE_HW_REV_3_20) {
> dev_err(pcie->dev, "hardware revision with unsupported PERST# setup\n");
> ret = -ENODEV;
[Severity: High]
This is a pre-existing issue, but looking at the error path later in
brcm_pcie_probe(), is it safe to call brcm_pcie_remove() when
pci_host_probe() fails?
If pci_host_probe(bridge) fails (for example, due to a memory allocation
failure inside pci_alloc_bus()), the bridge's bus structure might be freed
or remain NULL.
brcm_pcie_probe() {
...
ret = pci_host_probe(bridge);
if (ret) {
brcm_pcie_remove(pdev);
return ret;
}
}
brcm_pcie_remove() {
...
pci_stop_root_bus(bridge->bus);
}
Could this pci_stop_root_bus() call dereference a dangling or NULL
bridge->bus pointer, causing a crash instead of a graceful failure? Should
this path jump to the fail label instead to clean up local resources?
[Severity: High]
This is also a pre-existing issue, but does brcm_pcie_probe() use
pcie->bridge_lock before it is initialized?
Early in brcm_pcie_probe(), brcm_pcie_bridge_sw_init_set(pcie, 0) is called.
If the controller config has the HAS_ERR_REPORT flag set, this acquires
pcie->bridge_lock:
brcm_pcie_bridge_sw_init_set() {
if (BFLAG(pcie, HAS_ERR_REPORT))
spin_lock_irqsave(&pcie->bridge_lock, flags);
}
However, spin_lock_init(&pcie->bridge_lock) is not called until the very end
of brcm_pcie_probe(), right before it returns success.
Can this lead to an uninitialized spinlock usage on platforms with
HAS_ERR_REPORT enabled?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260911233541.1650895-1-james.quinlan@broadcom.com?part=10
next prev parent reply other threads:[~2026-09-11 23:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 23:35 [PATCH 00/13] PCI: brcmstb: Stop using chip numbers for conditions Jim Quinlan
2026-09-11 23:35 ` [PATCH 01/13] PCI: brcmstb: Remove redundant const specifier for struct fields Jim Quinlan
2026-09-11 23:39 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 02/13] PCI: brcmstb: Use flags u32 instead of bools Jim Quinlan
2026-09-11 23:47 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 03/13] PCI: brcmstb: Add Broadcom quirks macro Jim Quinlan
2026-09-11 23:40 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 04/13] PCI: brcmstb: Declare and assign quirk OB_WIN_32BIT_ADDR Jim Quinlan
2026-09-11 23:42 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 05/13] PCI: brcmstb: Declare and assign quirk OB_WIN_MAXSZ_128MB Jim Quinlan
2026-09-11 23:47 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 06/13] PCI: brcmstb: Declare and assign flag IS_BMIPS Jim Quinlan
2026-09-11 23:41 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 07/13] PCI: brcmstb: Declare and assign quirk 32BIT_PCI_OPS Jim Quinlan
2026-09-11 23:47 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 08/13] PCI: brcmstb: Declare and assign quirk NO_RGR1_TIMER Jim Quinlan
2026-09-11 23:43 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 09/13] PCI: brcmstb: Declare and assign quirk EARLY_PERST_ASSERT Jim Quinlan
2026-09-11 23:42 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 10/13] PCI: brcmstb: Declare and assign quirk PERST_PCIE_REV_CUTOFF Jim Quinlan
2026-09-11 23:49 ` sashiko-bot [this message]
2026-09-11 23:35 ` [PATCH 11/13] PCI: brcmstb: Put max_burst_size setting in cfg_data Jim Quinlan
2026-09-11 23:42 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 12/13] PCI: brcmstb: Use order-0 indexing for inbound BAR window array Jim Quinlan
2026-09-11 23:47 ` sashiko-bot
2026-09-11 23:35 ` [PATCH 13/13] PCI: brcmstb: Split up complicated function into two variants Jim Quinlan
2026-09-11 23:54 ` 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=20260911234913.470DE1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=james.quinlan@broadcom.com \
--cc=linux-pci@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.