]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ACPI / video: Do not bind to device objects with a scan handler
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 10 Jun 2013 11:00:29 +0000 (13:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Jun 2013 19:01:27 +0000 (12:01 -0700)
commit 8c9b7a7b2fc2750af418ddc28e707c42e78aa0bf upstream.

With the introduction of ACPI scan handlers, ACPI device objects
with an ACPI scan handler attached to them must not be bound to
by ACPI drivers any more.  Unfortunately, however, the ACPI video
driver attempts to do just that if there is a _ROM ACPI control
method defined under a device object with an ACPI scan handler.

Prevent that from happening by making the video driver's "add"
routine check if the device object already has an ACPI scan handler
attached to it and return an error code in that case.

That is not sufficient, though, because acpi_bus_driver_init() would
then clear the device object's driver_data that may be set by its
scan handler, so for the fix to work acpi_bus_driver_init() has to be
modified to leave driver_data as is on errors.

References: https://bugzilla.kernel.org/show_bug.cgi?id=58091
Bisected-and-tested-by: Dmitry S. Demin <dmitryy.demin@gmail.com>
Reported-and-tested-by: Jason Cassell <bluesloth600@gmail.com>
Tracked-down-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/scan.c
drivers/acpi/video.c

index 5e7e991717d76f97981fcff3d0a221879b47fcea..b32fc76cc4d4ae00f5f8fb4d0b7b57c9f1abd444 100644 (file)
@@ -830,11 +830,8 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver)
                return -ENOSYS;
 
        result = driver->ops.add(device);
-       if (result) {
-               device->driver = NULL;
-               device->driver_data = NULL;
+       if (result)
                return result;
-       }
 
        device->driver = driver;
 
index 81a9335092f69a8b9ed694e3877eb8bbf7bf7017..c397f3fb831339bf191e192185519aff9bc9d3ef 100644 (file)
@@ -1646,6 +1646,9 @@ static int acpi_video_bus_add(struct acpi_device *device)
        int error;
        acpi_status status;
 
+       if (device->handler)
+               return -EINVAL;
+
        status = acpi_walk_namespace(ACPI_TYPE_DEVICE,
                                device->parent->handle, 1,
                                acpi_video_bus_match, NULL,