ACPI: scan: Fix device object rescan in acpi_scan_clear_dep()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 16 Jun 2021 14:23:44 +0000 (16:23 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 17 Jun 2021 13:56:03 +0000 (15:56 +0200)
commitdc612486c91983a113adefedac030575ea7a4c4a
tree18f9e63707075079aa0ff9b2ec6a95e91ee2c4d9
parentaff0dbd03d3b750e2331f7cb93e01fe25ed27086
ACPI: scan: Fix device object rescan in acpi_scan_clear_dep()

In general, acpi_bus_attach() can only be run safely under
acpi_scan_lock, but that lock cannot be acquired under
acpi_dep_list_lock, so make acpi_scan_clear_dep() schedule deferred
execution of acpi_bus_attach() under acpi_scan_lock instead of
calling it directly.

This also fixes a possible race between acpi_scan_clear_dep() and
device removal that might cause a device object that went away to
be accessed, because acpi_scan_clear_dep() is changed to acquire
a reference on the consumer device object.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
drivers/acpi/scan.c