• Jiri Kosina's avatar
    HID: thingm: fix workqueue race on remove · 67a97845
    Jiri Kosina authored
    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: default avatarDylan Alex Simon <dylan-kernel@dylex.net>
    Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
    67a97845
hid-thingm.c 6.94 KB