diff options
author | Kees Cook <keescook@chromium.org> | 2013-08-28 22:32:01 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-26 17:18:17 -0700 |
commit | 8bb7aacefb408f829835f3692dd34fab9801d86d (patch) | |
tree | 1a5792f5a9639dada263c5dc1194280afb4bd586 /drivers/hid | |
parent | d0de24dd0e200c83382cd3fff8e8c06cb6dcef2b (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>
Diffstat (limited to 'drivers/hid')
-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 eb202481fb0..ed626e01514 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1156,7 +1156,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); |