Skip to content

Commit 4e4f974

Browse files
Hans Zhangbjorn-helgaas
authored andcommitted
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
1 parent a29812a commit 4e4f974

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/pci/controller/plda/pcie-plda-host.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,10 @@ EXPORT_SYMBOL_GPL(plda_pcie_host_init);
640640

641641
void plda_pcie_host_deinit(struct plda_pcie_rp *port)
642642
{
643+
pci_lock_rescan_remove();
643644
pci_stop_root_bus(port->bridge->bus);
644645
pci_remove_root_bus(port->bridge->bus);
646+
pci_unlock_rescan_remove();
645647

646648
plda_pcie_irq_domain_deinit(port);
647649

0 commit comments

Comments
 (0)