Skip to content

Commit 0bd9611

Browse files
Hans Zhangbjorn-helgaas
authored andcommitted
PCI: rockchip: 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-8-18255117159@163.com
1 parent 4e4f974 commit 0bd9611

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,8 +1012,10 @@ static void rockchip_pcie_remove(struct platform_device *pdev)
10121012
struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
10131013
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(rockchip);
10141014

1015+
pci_lock_rescan_remove();
10151016
pci_stop_root_bus(bridge->bus);
10161017
pci_remove_root_bus(bridge->bus);
1018+
pci_unlock_rescan_remove();
10171019
irq_domain_remove(rockchip->irq_domain);
10181020

10191021
rockchip_pcie_deinit_phys(rockchip);

0 commit comments

Comments
 (0)