diff options
author | Dexuan Cui <decui@microsoft.com> | 2019-08-02 22:50:20 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-10-05 12:47:37 +0200 |
commit | 7d11761a1b0bd71e567a0f4a8a6d7dfbfa9375de (patch) | |
tree | c52274a0aa2da33cc7adca86f8f2292b6e246f14 /drivers/pci | |
parent | f848684b7b363d5e02b204dadfe70938935e5e3a (diff) | |
download | linux-stable-7d11761a1b0bd71e567a0f4a8a6d7dfbfa9375de.tar.gz linux-stable-7d11761a1b0bd71e567a0f4a8a6d7dfbfa9375de.tar.bz2 linux-stable-7d11761a1b0bd71e567a0f4a8a6d7dfbfa9375de.zip |
PCI: hv: Avoid use of hv_pci_dev->pci_slot after freeing it
[ Upstream commit 533ca1feed98b0bf024779a14760694c7cb4d431 ]
The slot must be removed before the pci_dev is removed, otherwise a panic
can happen due to use-after-free.
Fixes: 15becc2b56c6 ("PCI: hv: Add hv_pci_remove_slots() when we unload the driver")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/host/pci-hyperv.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c index 5a9d94512232..70825689e5a0 100644 --- a/drivers/pci/host/pci-hyperv.c +++ b/drivers/pci/host/pci-hyperv.c @@ -2740,8 +2740,8 @@ static int hv_pci_remove(struct hv_device *hdev) /* Remove the bus from PCI's point of view. */ pci_lock_rescan_remove(); pci_stop_root_bus(hbus->pci_bus); - pci_remove_root_bus(hbus->pci_bus); hv_pci_remove_slots(hbus); + pci_remove_root_bus(hbus->pci_bus); pci_unlock_rescan_remove(); hbus->state = hv_pcibus_removed; } |