From: Rafael J. Wysocki Date: Fri, 12 Jul 2013 11:45:59 +0000 (+0200) Subject: ACPI / scan: Do not try to attach scan handlers to devices having them X-Git-Tag: v3.11-rc2~13^2~1^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3a391a39593b48341f0908511590a6c0e55cc069;p=thirdparty%2Fkernel%2Flinux.git ACPI / scan: Do not try to attach scan handlers to devices having them In acpi_bus_device_attach(), if there is an ACPI device object for the given handle and that device object has a scan handler attached to it already, there's nothing more to do for that handle. Moreover, if acpi_scan_attach_handler() is called then, it may execute the .attach() callback of the ACPI scan handler already attached to the device object and that may lead to interesting breakage. For this reason, make acpi_bus_device_attach() return success immediately when the handle's device object has a scan handler attached to it. Reported-by: Toshi Kani Signed-off-by: Rafael J. Wysocki Acked-by: Toshi Kani Cc: 3.10+ --- diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 10985573aaa7c..080d75962c572 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1981,6 +1981,9 @@ static acpi_status acpi_bus_device_attach(acpi_handle handle, u32 lvl_not_used, if (acpi_bus_get_device(handle, &device)) return AE_CTRL_DEPTH; + if (device->handler) + return AE_OK; + ret = acpi_scan_attach_handler(device); if (ret) return ret > 0 ? AE_OK : AE_CTRL_DEPTH;