hp_accel: fix race in device removal
authorOliver Neukum <[email protected]>
Tue, 11 May 2010 21:07:03 +0000 (14:07 -0700)
committerLinus Torvalds <[email protected]>
Wed, 12 May 2010 00:33:42 +0000 (17:33 -0700)
The work queue has to be flushed after the device has been made
inaccessible.  The patch closes a window during which a work queue might
remain active after the device is removed and would then lead to ACPI
calls with undefined behavior.

Signed-off-by: Oliver Neukum <[email protected]>
Acked-by: Eric Piel <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Cc: Pavel Herrmann <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/hwmon/hp_accel.c

index c8ab5051667217ab02321ec8a2a2d14db5a48104..7580f55e67e3cf1560437b428d9fb1e5b8e411d0 100644 (file)
@@ -328,8 +328,8 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
        lis3lv02d_joystick_disable();
        lis3lv02d_poweroff(&lis3_dev);
 
-       flush_work(&hpled_led.work);
        led_classdev_unregister(&hpled_led.led_classdev);
+       flush_work(&hpled_led.work);
 
        return lis3lv02d_remove_fs(&lis3_dev);
 }