Commit ed63902e authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by liwei
Browse files

ACPI: bus: Ensure that notify handlers are not running after removal

mainline inclusion
from mainline-v6.4-rc1
commit faae4437
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9NZ3E
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=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: 5894b0c4 ("ACPI / scan: Move bus operations and notification routines to bus.c")
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>

Conflicts:
	drivers/acpi/bus.c
Signed-off-by: default avatarliwei <liwei728@huawei.com>
parent 623051c7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -477,6 +477,8 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device)
	else
		acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
					   acpi_device_notify);

	acpi_os_wait_events_complete();
}

/* Handle events targeting \_SB device (at present only graceful shutdown) */