diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2026-09-10 19:56:04 +0200 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2026-09-11 15:26:00 +0200 |
| commit | c94619c8a5b5d3b980433d247ac87a2d1c827cb6 (patch) | |
| tree | bf98b60991b8a621401df4a4d25811ff58276736 /include/linux | |
| parent | aef7792cddcac7ab400912c2947a595401d4a7e8 (diff) | |
ACPI: glue: Carry out companion lookup under bus_type_sem
When acpi_device_notify() looks up an ACPI companion for the given
device, it invokes callbacks from struct acpi_bus_type() without
synchronization which may lead to a use-after-free if the driver
module containing those callbacks is unloaded at the same time.
Address this by holding bus_type_sem throughout the entire ACPI
companion lookup and the execution of the .setup() callback in
struct acpi_bus_type (if present) instead of dropping the semaphore
(prematurely) after finding a matching struct acpi_bus_type.
For this purpose, rename acpi_get_bus_type() to acpi_companion_lookup(),
make it return a struct acpi_device pointer, and move the relevant code
from acpi_device_notify() to it.
Also notice that the only case in which the .bind() callback from an
ACPI scan handler may need to be invoked is when the given device is
a platform one, so adjust acpi_device_notify() accordingly and drop
the "done" label that is not used any more from it.
Fixes: 2ef5236660b6 ("ACPI: glue: Look for ACPI bus type only if ACPI companion is not known")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/3089807.e9J7NaK4W3@rafael.j.wysocki
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
