linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI: PCI: Fix device reference counting in acpi_get_pci_dev()
@ 2022-10-18 17:34 Rafael J. Wysocki
  2022-10-19  8:54 ` Ville Syrjälä
  0 siblings, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2022-10-18 17:34 UTC (permalink / raw)
  To: Linux PCI; +Cc: Linux ACPI, LKML, Greg Kroah-Hartman, Bjorn Helgaas

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Commit 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()") failed
to reference count the device returned by acpi_get_pci_dev() as
expected by its callers which in some cases may cause device objects
to be dropped prematurely.

Add the missing get_device() to acpi_get_pci_dev().

Fixes: 63f534b8bad9 ("ACPI: PCI: Rework acpi_get_pci_dev()")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/pci_root.c |    1 +
 1 file changed, 1 insertion(+)

Index: linux-pm/drivers/acpi/pci_root.c
===================================================================
--- linux-pm.orig/drivers/acpi/pci_root.c
+++ linux-pm/drivers/acpi/pci_root.c
@@ -323,6 +323,7 @@ struct pci_dev *acpi_get_pci_dev(acpi_ha
 
 	list_for_each_entry(pn, &adev->physical_node_list, node) {
 		if (dev_is_pci(pn->dev)) {
+			get_device(pn->dev);
 			pci_dev = to_pci_dev(pn->dev);
 			break;
 		}




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-10-19 17:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18 17:34 [PATCH] ACPI: PCI: Fix device reference counting in acpi_get_pci_dev() Rafael J. Wysocki
2022-10-19  8:54 ` Ville Syrjälä
2022-10-19 11:35   ` Rafael J. Wysocki
2022-10-19 12:22     ` Ville Syrjälä
2022-10-19 12:57       ` Jani Nikula
2022-10-19 13:00       ` Rafael J. Wysocki
2022-10-19 16:53   ` Bjorn Helgaas
2022-10-19 17:40     ` Ville Syrjälä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).