diff options
author | Stefan Achatz <erazor_de@users.sourceforge.net> | 2011-06-12 10:02:44 +0200 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-06-13 13:06:23 +0200 |
commit | 901e64dbdb5998b9248c372a401c921bbdf662f6 (patch) | |
tree | 439c7685adb52e2b97b968ee6535da29a8434915 /drivers/hid/hid-roccat-arvo.c | |
parent | 1edd5b42a6631b1b1f147e9018e309bde8d96a05 (diff) | |
download | linux-stable-901e64dbdb5998b9248c372a401c921bbdf662f6.tar.gz linux-stable-901e64dbdb5998b9248c372a401c921bbdf662f6.tar.bz2 linux-stable-901e64dbdb5998b9248c372a401c921bbdf662f6.zip |
HID: roccat: fix NULL pointer dereference, add range checks
On rare occassions raw events can be triggered before drvdata gets set up
which leads to NULL pointer dereferences. This was only observed with pyra on
2.6.39, but is fixed for all devices now to play it save.
kovaplus returned wrong actual values when profile change was initiated from host.
Added range checks for setting actual profile on all devices.
Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-roccat-arvo.c')
-rw-r--r-- | drivers/hid/hid-roccat-arvo.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hid/hid-roccat-arvo.c b/drivers/hid/hid-roccat-arvo.c index 610536606195..093bfad00b02 100644 --- a/drivers/hid/hid-roccat-arvo.c +++ b/drivers/hid/hid-roccat-arvo.c @@ -163,6 +163,9 @@ static ssize_t arvo_sysfs_set_actual_profile(struct device *dev, if (retval) return retval; + if (profile < 1 || profile > 5) + return -EINVAL; + temp_buf.command = ARVO_COMMAND_ACTUAL_PROFILE; temp_buf.actual_profile = profile; @@ -399,7 +402,7 @@ static int arvo_raw_event(struct hid_device *hdev, if (size != 3) return 0; - if (arvo->roccat_claimed) + if (arvo && arvo->roccat_claimed) arvo_report_to_chrdev(arvo, data); return 0; |