From: Oliver Neukum Date: Tue, 11 May 2010 21:07:03 +0000 (-0700) Subject: hp_accel: fix race in device removal X-Git-Tag: firefly_0821_release~10186^2~1619 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7b7be5f379bd001c86372c2e042cb7779c4f0a06;p=firefly-linux-kernel-4.4.55.git hp_accel: fix race in device removal commit 06efbeb4a47b6f865e1c9d175ab9d6e90b69ae9e upstream. 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 Acked-by: Eric Piel Acked-by: Pavel Machek Cc: Pavel Herrmann Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c index be475e844c2a..f16d60f0bf47 100644 --- a/drivers/hwmon/hp_accel.c +++ b/drivers/hwmon/hp_accel.c @@ -324,8 +324,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); }