linux/include/acpi
Rafael J. Wysocki 72530e1f72 ACPI: bus: Introduce acpi_bus_get_primary_device()
The function used for obtaining the first "physical" device for which
the given ACPI one is the ACPI companion, acpi_get_first_physical_node(),
may return a stale device pointer (mostly in theory) because
acpi_unbind_one() may run as a whole after dropping the ACPI device's
physical_node_lock in acpi_get_first_physical_node() and before it
returns.  The last reference to the "physical" device may be dropped
then before the pointer to it is returned to the caller.

If that happens and the acpi_get_first_physical_node() caller invokes
get_device() on the pointer obtained from it, which is done by the
majority of its callers, a use-after-free will occur.

To prepare for addressing this problem, introduce a new function for
getting the first "physical" device associated with the given ACPI one
(the "primary physical device") that will also reference count the
device in question before returning a pointer to it.

Make that new function and acpi_get_first_physical_node() share the
physical node list lookup code.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/2843318.mvXUDI8C0e@rafael.j.wysocki
2026-08-14 21:49:41 +02:00
..
platform ACPICA: Define acpi_ut_safe_strncpy() as strscpy_pad() alias 2026-07-01 12:29:24 +02:00
acbuffer.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
acconfig.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
acexcep.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
acnames.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
acoutput.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
acpi_bus.h ACPI: bus: Introduce acpi_bus_get_primary_device() 2026-08-14 21:49:41 +02:00
acpi_drivers.h ACPI: PCI: IRQ: Fix INTx GSIs signedness 2026-01-05 19:06:40 +01:00
acpi_io.h
acpi_lpat.h
acpi_numa.h mm/fake-numa: allow later numa node hotplug 2025-01-25 20:22:29 -08:00
acpi.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
acpiosxf.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
acpixf.h Merge branch 'acpica' 2026-06-11 14:57:55 +02:00
acrestyp.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
actbl.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
actbl1.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
actbl2.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
actbl3.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
actypes.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
acuuid.h ACPICA: Update the copyright year to 2026 2026-05-27 20:18:47 +02:00
apei.h ACPI: APEI: Fix missing ERST record id 2022-04-13 20:29:24 +02:00
battery.h ACPI: battery: add devm_battery_hook_register() 2024-07-01 21:22:18 +08:00
button.h
cppc_acpi.h ACPI: CPPC: Check all controls for fast switching 2026-07-22 15:09:14 +02:00
ghes.h ACPI: APEI: GHES: Add devm_ghes_register_vendor_record_notifier() 2026-04-06 16:48:58 +02:00
hed.h
nfit.h
nhlt.h ACPI: NHLT: Streamline struct naming 2024-03-27 16:36:45 +01:00
pcc.h Revert "mailbox/pcc: support mailbox management of the shared buffer" 2026-01-18 14:19:20 -06:00
proc_cap_intel.h ACPI: processor: Introduce acpi_processor_osc() 2023-07-14 17:59:40 +02:00
processor.h ACPI: driver: Do not set acpi_device_class() unnecessarily 2026-03-13 16:48:26 +01:00
reboot.h
video.h ACPI: video: Add Dell UART backlight controller detection 2024-08-19 15:58:35 +02:00