Skip to contentSkip to conversation

FAILED: patch "[PATCH] PCI: hv: Avoid use of hv_pci_dev->pci_slot after freeing it" failed to apply to 4.19-stable tree

PATCH [email protected] 3 participants 3 messages Oct 8, 2019

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 533ca1feed98b0bf024779a14760694c7cb4d431 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <[email protected]>
Date: Fri, 2 Aug 2019 22:50:20 +0000
Subject: [PATCH] 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")
drivers/pci/controller/pci-hyperv.c +1 -1
index 40b625458afa..2b53976cd9f9 100644
@@ -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;
 	}
maintainer
#1 lore raw
Quoted 41 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Tuesday, October 8, 2019 10:19 AM
To: Dexuan Cui <[email protected]>; [email protected]
Cc: [email protected]
Subject: FAILED: patch "[PATCH] PCI: hv: Avoid use of hv_pci_dev->pci_slot after freeing it" failed to apply to 4.19-stable tree

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 533ca1feed98b0bf024779a14760694c7cb4d431 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <[email protected]>
Date: Fri, 2 Aug 2019 22:50:20 +0000
Subject: [PATCH] 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")

drivers/pci/controller/pci-hyperv.c +0 -0
index 40b625458afa..2b53976cd9f9 100644

drivers/pci/controller/pci-hyperv.c static int hv_pci_remove(struct hv_device *hdev) · line 2708

Quoted 9 lines
drivers/pci/controller/pci-hyperv.c +1 -1
@@ -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;
 	}

I can't understand why the mail is generated, because v4.19.78 has already included the commit 533ca1feed98 ("PCI: hv: Avoid use of hv_pci_dev->pci_slot after freeing it") by
commit 08fdaee2d97bdd55e03308b563783b2612670e8b

Author: Dexuan Cui <[email protected]>
Date:   Fri Aug 2 22:50:20 2019 +0000

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")

Looks I can ignore the mail.

Thanks,
Dexuan

maintainer
#2 lore raw
In reply to [email protected]
Quoted 17 lines · On Tue, Oct 08, 2019 at 07:18:44PM +0200, [email protected] wrote:

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 533ca1feed98b0bf024779a14760694c7cb4d431 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <[email protected]>
Date: Fri, 2 Aug 2019 22:50:20 +0000
Subject: [PATCH] PCI: hv: Avoid use of hv_pci_dev->pci_slot after freeing it

Quoted 7 lines

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")

Doesn't look like it's relevant for <=4.19 .

Signature · 2 lines
Thanks,
Sasha