diff options
author | Kees Cook <keescook@chromium.org> | 2013-08-28 22:32:01 +0200 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2013-10-26 21:06:02 +0100 |
commit | 45e61ad38c9493eec7ece2bfe09bde2433cdaa87 (patch) | |
tree | b029ca439ccd69c600bff706153bea5d59116fbc | |
parent | 49ad1670d8a0a8e9a7f84272e3054c80563b87bc (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: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | drivers/hid/hid-core.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 91b8478afaa..c2f71a33639 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -994,7 +994,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); |