diff options
author | Stefan Achatz <erazor_de@users.sourceforge.net> | 2011-06-12 04:02:44 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-06-13 07:06:23 -0400 |
commit | 901e64dbdb5998b9248c372a401c921bbdf662f6 (patch) | |
tree | 439c7685adb52e2b97b968ee6535da29a8434915 /drivers/hid/hid-roccat-kovaplus.c | |
parent | 1edd5b42a6631b1b1f147e9018e309bde8d96a05 (diff) |
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-kovaplus.c')
-rw-r--r-- | drivers/hid/hid-roccat-kovaplus.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c index 212e7921e942..1f8336e3f584 100644 --- a/drivers/hid/hid-roccat-kovaplus.c +++ b/drivers/hid/hid-roccat-kovaplus.c | |||
@@ -337,7 +337,7 @@ static ssize_t kovaplus_sysfs_set_actual_profile(struct device *dev, | |||
337 | 337 | ||
338 | mutex_lock(&kovaplus->kovaplus_lock); | 338 | mutex_lock(&kovaplus->kovaplus_lock); |
339 | retval = kovaplus_set_actual_profile(usb_dev, profile); | 339 | retval = kovaplus_set_actual_profile(usb_dev, profile); |
340 | kovaplus->actual_profile = profile; | 340 | kovaplus_profile_activated(kovaplus, profile); |
341 | mutex_unlock(&kovaplus->kovaplus_lock); | 341 | mutex_unlock(&kovaplus->kovaplus_lock); |
342 | if (retval) | 342 | if (retval) |
343 | return retval; | 343 | return retval; |
@@ -662,6 +662,9 @@ static int kovaplus_raw_event(struct hid_device *hdev, | |||
662 | != USB_INTERFACE_PROTOCOL_MOUSE) | 662 | != USB_INTERFACE_PROTOCOL_MOUSE) |
663 | return 0; | 663 | return 0; |
664 | 664 | ||
665 | if (kovaplus == NULL) | ||
666 | return 0; | ||
667 | |||
665 | kovaplus_keep_values_up_to_date(kovaplus, data); | 668 | kovaplus_keep_values_up_to_date(kovaplus, data); |
666 | 669 | ||
667 | if (kovaplus->roccat_claimed) | 670 | if (kovaplus->roccat_claimed) |