summaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJanne Kanniainen <janne.kanniainen@gmail.com>2014-07-03 19:17:08 +0200
committerBryan Wu <cooloney@gmail.com>2014-07-03 20:12:16 +0200
commitc3883ae918c8754f7c251564d63211e1d5648b08 (patch)
treed0385ed9577b937f40da7416c238de15ba304954 /drivers/hid
parentHID: add support for MSI GT683R led panels (diff)
downloadlinux-c3883ae918c8754f7c251564d63211e1d5648b08.tar.xz
linux-c3883ae918c8754f7c251564d63211e1d5648b08.zip
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>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-gt683r.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/hid/hid-gt683r.c b/drivers/hid/hid-gt683r.c
index 077f7a19c9d5..073bd80ec839 100644
--- a/drivers/hid/hid-gt683r.c
+++ b/drivers/hid/hid-gt683r.c
@@ -227,6 +227,9 @@ static int gt683r_led_probe(struct hid_device *hdev,
if (!led)
return -ENOMEM;
+ mutex_init(&led->lock);
+ INIT_WORK(&led->work, gt683r_led_work);
+
led->mode = GT683R_LED_NORMAL;
led->hdev = hdev;
hid_set_drvdata(hdev, led);
@@ -271,9 +274,6 @@ static int gt683r_led_probe(struct hid_device *hdev,
goto fail;
}
- mutex_init(&led->lock);
- INIT_WORK(&led->work, gt683r_led_work);
-
return 0;
fail: