summary refs log tree commit diff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-04-14 16:00:48 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-11 23:03:16 +0900
commit0985838a9c87f4870ea9135df9d339fc5846994c (patch)
treeb3d535fdb46918fa0d85f26ca5b7f3bdf362207f /drivers/acpi
parent290e26ec0d012b70ab7e4a9a59924682d0ed4ce8 (diff)
downloadlinux-0985838a9c87f4870ea9135df9d339fc5846994c.tar.gz
ACPI: bus: Ensure that notify handlers are not running after removal
[ Upstream commit faae443738c6f0dac9b0d3d11d108f6911a989a9 ]

Currently, acpi_device_remove_notify_handler() may return while the
notify handler being removed is still running which may allow the
module holding that handler to be torn down prematurely.

Address this issue by making acpi_device_remove_notify_handler() wait
for the handling of all the ACPI events in progress to complete before
returning.

Fixes: 5894b0c46e49 ("ACPI / scan: Move bus operations and notification routines to bus.c")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/bus.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 3b6146b1e25c..a16b7de73d16 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -586,6 +586,7 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device,
 		acpi_remove_notify_handler(device->handle, type,
 					   acpi_notify_device);
 	}
+	acpi_os_wait_events_complete();
 }
 
 /* Handle events targeting \_SB device (at present only graceful shutdown) */