summaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorTyrel Datwyler <tyreld@linux.ibm.com>2021-02-11 12:24:35 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-22 10:59:37 +0200
commit7845bf7fad958e5fc58a3de0a833ff4c803c8197 (patch)
tree5c289c458a597599cf379281cf1d90b969455cd0 /arch/powerpc
parent7a73666d0d92ee82e40079fd3d2ffdb39cf1b241 (diff)
downloadlinux-stable-7845bf7fad958e5fc58a3de0a833ff4c803c8197.tar.gz
linux-stable-7845bf7fad958e5fc58a3de0a833ff4c803c8197.tar.bz2
linux-stable-7845bf7fad958e5fc58a3de0a833ff4c803c8197.zip
powerpc/pseries: extract host bridge from pci_bus prior to bus removal
[ Upstream commit 38d0b1c9cec71e6d0f3bddef0bbce41d05a3e796 ] 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: 7340056567e3 ("powerpc/pci: Reorder pci bus/bridge unregistration during PHB removal") Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20210211182435.47968-1-tyreld@linux.ibm.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 561917fa54a8..afca4b737e80 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -66,6 +66,7 @@ EXPORT_SYMBOL_GPL(init_phb_dynamic);
int remove_phb_dynamic(struct pci_controller *phb)
{
struct pci_bus *b = phb->bus;
+ struct pci_host_bridge *host_bridge = to_pci_host_bridge(b->bridge);
struct resource *res;
int rc, i;
@@ -92,7 +93,8 @@ int remove_phb_dynamic(struct pci_controller *phb)
/* Remove the PCI bus and unregister the bridge device from sysfs */
phb->bus = NULL;
pci_remove_bus(b);
- device_unregister(b->bridge);
+ host_bridge->bus = NULL;
+ device_unregister(&host_bridge->dev);
/* Now release the IO resource */
if (res->flags & IORESOURCE_IO)