From: sashiko-bot@kernel.org
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 1/2] PCI: Export pci_parent_bus_reset() for drivers to use
Date: Tue, 05 May 2026 00:38:27 +0000 [thread overview]
Message-ID: <20260505003827.D2F0CC2BCB8@smtp.kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.21.2605050051390.46195@angie.orcam.me.uk>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Unprotected list traversal and data race in `pci_parent_bus_reset()` exposed to external drivers.
- [High] Exporting `pci_parent_bus_reset()` creates an unsafe API that bypasses mandatory PCI core state management and synchronization.
--
commit 73a6ae560868e4a44decb13db21d60108f4c09f1
Author: Maciej W. Rozycki <macro@orcam.me.uk>
PCI: Export pci_parent_bus_reset() for drivers to use
This commit removes the static modifier from pci_parent_bus_reset(),
adds kernel doc comments, and exports it using EXPORT_SYMBOL_GPL()
so that external drivers can trigger a secondary bus reset via the
device's immediate upstream bridge.
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -4820,7 +4820,21 @@ int pci_bridge_secondary_bus_reset(struct pci_dev *dev)
[ ... ]
> +int pci_parent_bus_reset(struct pci_dev *dev, bool probe)
> {
> struct pci_dev *pdev;
>
Internally, pci_parent_bus_reset() traverses dev->bus->devices using
list_for_each_entry() locklessly.
Reading this list typically requires holding pci_bus_sem to protect against
concurrent modifications from hotplug events.
Since pci_bus_sem is an internal lock and not exported to modules, drivers
utilizing this newly exported API will not be able to acquire the required
locks prior to calling it.
Does exporting this function introduce a regression regarding list
corruption or use-after-free?
> @@ -4837,6 +4851,7 @@ static int pci_parent_bus_reset(struct pci_dev *dev, bool probe)
>
> return pci_bridge_secondary_bus_reset(dev->bus->self);
> }
> +EXPORT_SYMBOL_GPL(pci_parent_bus_reset);
Unlike higher-level APIs like pci_reset_function(), this newly exported
function does not save and restore the PCI configuration space or prepare
the IOMMU for DMA reset.
Additionally, pci_bridge_secondary_bus_reset() expects the bridge
configuration access to be locked, and emits a warning if it is not:
pci_bridge_secondary_bus_reset() {
if (!dev->block_cfg_access)
pci_warn_once(dev, "unlocked secondary bus reset via...");
}
Could drivers utilizing this export trigger system instability or
uncorrectable errors while DMA is active, since it bypasses state
management and locking steps like acquiring pci_dev_lock() on the upstream
bridge?
--
Sashiko AI review · https://sashiko.dev/#/patchset/alpine.DEB.2.21.2605050042390.46195@angie.orcam.me.uk?part=1
next prev parent reply other threads:[~2026-05-05 0:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 0:03 [PATCH v2 0/2] PCI+IB/hfi1: Fold duplicate secondary bus reset code Maciej W. Rozycki
2026-05-05 0:03 ` [PATCH v2 1/2] PCI: Export pci_parent_bus_reset() for drivers to use Maciej W. Rozycki
2026-05-05 0:38 ` sashiko-bot [this message]
2026-05-12 9:00 ` Leon Romanovsky
2026-05-12 10:17 ` Maciej W. Rozycki
2026-05-05 0:03 ` [PATCH v2 2/2] IB/hfi1: Remove pci_parent_bus_reset() duplication Maciej W. Rozycki
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=20260505003827.D2F0CC2BCB8@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=macro@orcam.me.uk \
--cc=sashiko@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