From 03370abe343257d9682e49b9bc53fdee191af19c Mon Sep 17 00:00:00 2001 From: Niklas Schnelle Date: Thu, 12 Jun 2025 19:43:05 +0200 Subject: [PATCH] s390/pci: Fix duplicate pci_dev_put() in disable_slot() when PF has child VFs BugLink: https://bugs.launchpad.net/bugs/2114174 With commit bcb5d6c76903 ("s390/pci: introduce lock to synchronize state of zpci_dev's") the code to ignore power off of a PF that has child VFs was changed from a direct return to a goto to the unlock and pci_dev_put() section. The change however left the existing pci_dev_put() untouched resulting in a doubple put. This can subsequently cause a use after free if the struct pci_dev is released in an unexpected state. Fix this by removing the extra pci_dev_put(). Cc: stable@vger.kernel.org Fixes: bcb5d6c76903 ("s390/pci: introduce lock to synchronize state of zpci_dev's") Signed-off-by: Niklas Schnelle Reviewed-by: Gerd Bayer Signed-off-by: Heiko Carstens (cherry picked from commit 05a2538f2b48500cf4e8a0a0ce76623cc5bafcf1) CVE-2025-37946 Signed-off-by: Massimiliano Pellizzer Acked-by: Edoardo Canepa Acked-by: Manuel Diewald Acked-by: Mehmet Basaran Signed-off-by: Mehmet Basaran --- drivers/pci/hotplug/s390_pci_hpc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/pci/hotplug/s390_pci_hpc.c b/drivers/pci/hotplug/s390_pci_hpc.c index 7333b305f2a5..9be65c4103df 100644 --- a/drivers/pci/hotplug/s390_pci_hpc.c +++ b/drivers/pci/hotplug/s390_pci_hpc.c @@ -59,7 +59,6 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); if (pdev && pci_num_vf(pdev)) { - pci_dev_put(pdev); rc = -EBUSY; goto out; }