aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2013-08-28 22:32:01 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-26 17:15:49 -0700
commit9d18e13efe885df3c22df16a30d7ebe5b2d89232 (patch)
tree3bff9cb989415299959c19bebeb6f7c32d238e4a
parent735b7d0c03d9535a1fc74ba8fa4beccdf7ab949d (diff)
HID: check for NULL field when setting values
commit be67b68d52fa28b9b721c47bb42068f0c1214855 upstream. Defensively check that the field to be worked on is not NULL. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 228c8495e97..ab59fdf0623 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -999,7 +999,12 @@ EXPORT_SYMBOL_GPL(hid_output_report);
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);