]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
PCI/pwrctrl: Fix device leak at device stop
authorJohan Hovold <johan+linaro@kernel.org>
Mon, 21 Jul 2025 15:36:09 +0000 (17:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 19 Oct 2025 14:37:35 +0000 (16:37 +0200)
commit dc32e9346b26ba33e84ec3034a1e53a9733700f9 upstream.

Make sure to drop the reference to the pwrctrl device taken by
of_find_device_by_node() when stopping a PCI device.

Fixes: 681725afb6b9 ("PCI/pwrctl: Remove pwrctl device without iterating over all children of pwrctl parent")
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Cc: stable@vger.kernel.org # v6.13
Link: https://patch.msgid.link/20250721153609.8611-4-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/remove.c

index 445afdfa6498edc88f1ef89df279af1419025495..16f21edbc29d401b9abb01d4b499e457e7b0b9d2 100644 (file)
@@ -31,6 +31,8 @@ static void pci_pwrctrl_unregister(struct device *dev)
                return;
 
        of_device_unregister(pdev);
+       put_device(&pdev->dev);
+
        of_node_clear_flag(np, OF_POPULATED);
 }