]> git.baikalelectronics.ru Git - kernel.git/commit
HID: thingm: fix workqueue race on remove
authorJiri Kosina <jkosina@suse.cz>
Thu, 4 Sep 2014 06:56:06 +0000 (08:56 +0200)
committerJiri Kosina <jkosina@suse.cz>
Thu, 4 Sep 2014 06:56:06 +0000 (08:56 +0200)
commitcdd99c296386b9f526406eeeb8dd133137b347e4
tree250856471e985b57ccdc216ecd5c6f1ba9352679
parent4ce1613561e1eb9f8cb868f5b3bc72703f12c8d4
HID: thingm: fix workqueue race on remove

thingm_remove_rgb() needs to flush the workqueue after all the LED classes
have been unregistered, otherwise the removal might race with another LED
event coming, causing thingm_led_set() to schedule additional work after
thingm_remove_rgb() has flushed it. This obviously causes oops later, as
the scheduled work has been freed in the meantime.

In addition to that, move the hid_hw_stop() to an earlier place, so that
dmesg is not polluted by failure messages about not being able to write
the LED while the device is being shut down.

Reported-and-tested-by: Dylan Alex Simon <dylan-kernel@dylex.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-thingm.c