summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Zhang <18255117159@163.com>2026-05-22 00:18:22 +0800
committerBjorn Helgaas <bhelgaas@google.com>2026-06-18 11:50:55 -0500
commit4e4f9745f016c1631d00a4035b06f6e75d449e01 (patch)
tree9a0f2d56846c69b40ed17853e767f57cbdd09864
parenta29812a55da8d0dbeb071b26ac428c338e3fc389 (diff)
PCI: plda: Protect root bus removal with rescan lock
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes. Signed-off-by: Hans Zhang <18255117159@163.com> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/20260521161822.132996-10-18255117159@163.com
-rw-r--r--drivers/pci/controller/plda/pcie-plda-host.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/pci/controller/plda/pcie-plda-host.c b/drivers/pci/controller/plda/pcie-plda-host.c
index 3c2f68383010..f9a34f323ad8 100644
--- a/drivers/pci/controller/plda/pcie-plda-host.c
+++ b/drivers/pci/controller/plda/pcie-plda-host.c
@@ -640,8 +640,10 @@ EXPORT_SYMBOL_GPL(plda_pcie_host_init);
void plda_pcie_host_deinit(struct plda_pcie_rp *port)
{
+ pci_lock_rescan_remove();
pci_stop_root_bus(port->bridge->bus);
pci_remove_root_bus(port->bridge->bus);
+ pci_unlock_rescan_remove();
plda_pcie_irq_domain_deinit(port);