summaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2013-08-28 22:32:01 +0200
committerJiri Kosina <jkosina@suse.cz>2013-09-04 12:05:31 +0200
commitbe67b68d52fa28b9b721c47bb42068f0c1214855 (patch)
tree8be7d0b0194e6c7c138c55dccdefaf406dd6e46c /drivers/hid
parent1e87a2456b0227ca4ab881e19a11bb99d164e792 (diff)
downloadlinux-be67b68d52fa28b9b721c47bb42068f0c1214855.tar.bz2
HID: check for NULL field when setting values
Defensively check that the field to be worked on is not NULL. Signed-off-by: Kees Cook <keescook@chromium.org> Cc: stable@kernel.org Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-core.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index ebf57813d31a..dcd60eb3d5ea 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1169,7 +1169,12 @@ EXPORT_SYMBOL_GPL(hid_alloc_report_buf);
int hid_set_field(struct hid_field *field, unsigned offset, __s32 value)
{
- unsigned size = field->report_size;
+ unsigned size;
+
+ if (!field)
+ return -1;
+
+ size = field->report_size;
hid_dump_input(field->report->device, field->usage + offset, value);