Skip to content

Commit 38d0b1c

Browse files
tyreldmpe
authored andcommitted
powerpc/pseries: extract host bridge from pci_bus prior to bus removal
The pci_bus->bridge reference may no longer be valid after pci_bus_remove() resulting in passing a bad value to device_unregister() for the associated bridge device. Store the host_bridge reference in a separate variable prior to pci_bus_remove(). Fixes: 7340056 ("powerpc/pci: Reorder pci bus/bridge unregistration during PHB removal") Signed-off-by: Tyrel Datwyler <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0751fdf commit 38d0b1c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/powerpc/platforms/pseries/pci_dlpar.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ EXPORT_SYMBOL_GPL(init_phb_dynamic);
5050
int remove_phb_dynamic(struct pci_controller *phb)
5151
{
5252
struct pci_bus *b = phb->bus;
53+
struct pci_host_bridge *host_bridge = to_pci_host_bridge(b->bridge);
5354
struct resource *res;
5455
int rc, i;
5556

@@ -76,7 +77,8 @@ int remove_phb_dynamic(struct pci_controller *phb)
7677
/* Remove the PCI bus and unregister the bridge device from sysfs */
7778
phb->bus = NULL;
7879
pci_remove_bus(b);
79-
device_unregister(b->bridge);
80+
host_bridge->bus = NULL;
81+
device_unregister(&host_bridge->dev);
8082

8183
/* Now release the IO resource */
8284
if (res->flags & IORESOURCE_IO)

0 commit comments

Comments
 (0)