aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/pci/controller/pci-hyperv.c
diff options
context:
space:
mode:
authorDexuan Cui <decui@microsoft.com>2019-08-02 22:50:20 +0000
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2019-08-12 14:14:00 +0100
commit533ca1feed98b0bf024779a14760694c7cb4d431 (patch)
treeddc521c5d171ede296f6e5d3653c2812e3ca591a /drivers/pci/controller/pci-hyperv.c
parentLinus 5.3-rc1 (diff)
downloadwireguard-linux-533ca1feed98b0bf024779a14760694c7cb4d431.tar.xz
wireguard-linux-533ca1feed98b0bf024779a14760694c7cb4d431.zip
PCI: hv: Avoid use of hv_pci_dev->pci_slot after freeing it
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
Diffstat (limited to 'drivers/pci/controller/pci-hyperv.c')
-rw-r--r--drivers/pci/controller/pci-hyperv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 40b625458afa..2b53976cd9f9 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -2701,8 +2701,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;
}