aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-12 07:45:59 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-04 04:51:01 -0400
commit85471df478e22dd96ca4756789abc795683addc9 (patch)
treeeb9c91a4cce3ab9db025f0bfc369ea30654f0280
parent9d80c9e6f3345b343b9a095e8591f7c8a164b2c0 (diff)
ACPI / scan: Do not try to attach scan handlers to devices having them
commit 3a391a39593b48341f0908511590a6c0e55cc069 upstream. 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 <toshi.kani@hp.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/acpi/scan.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 966bcba529ec..af658b2ff279 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1892,6 +1892,9 @@ static acpi_status acpi_bus_device_attach(acpi_handle handle, u32 lvl_not_used,
1892 if (acpi_bus_get_device(handle, &device)) 1892 if (acpi_bus_get_device(handle, &device))
1893 return AE_CTRL_DEPTH; 1893 return AE_CTRL_DEPTH;
1894 1894
1895 if (device->handler)
1896 return AE_OK;
1897
1895 ret = acpi_scan_attach_handler(device); 1898 ret = acpi_scan_attach_handler(device);
1896 if (ret) 1899 if (ret)
1897 return ret > 0 ? AE_OK : AE_CTRL_DEPTH; 1900 return ret > 0 ? AE_OK : AE_CTRL_DEPTH;