Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: gt683r: fix race condition

This will fix race condition noticed by Oliver Neukum. Sysfs files are
created before mutex and work are initialized.

Signed-off-by: Janne Kanniainen <janne.kanniainen@gmail.com>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Bryan Wu <cooloney@gmail.com>

authored by

Janne Kanniainen and committed by
Bryan Wu
c3883ae9 f471d948

+3 -3
+3 -3
drivers/hid/hid-gt683r.c
··· 227 227 if (!led) 228 228 return -ENOMEM; 229 229 230 + mutex_init(&led->lock); 231 + INIT_WORK(&led->work, gt683r_led_work); 232 + 230 233 led->mode = GT683R_LED_NORMAL; 231 234 led->hdev = hdev; 232 235 hid_set_drvdata(hdev, led); ··· 273 270 hid_err(hdev, "could not make mode attribute file\n"); 274 271 goto fail; 275 272 } 276 - 277 - mutex_init(&led->lock); 278 - INIT_WORK(&led->work, gt683r_led_work); 279 273 280 274 return 0; 281 275