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 16:52:48 -0700 |
commit | fc4a8fd8746dcd6ff011bc61c06fe9cf5ed2015a (patch) | |
tree | 943afdd6b0a5baf01c201463af559f99619d1f45 | |
parent | 0d564bb5984ae5b94233bc0bdb0e38073fc1b038 (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.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index bc0bb213e77..a9c2b689e98 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -993,7 +993,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); |