diff options
author | Jiri Kosina <jkosina@suse.cz> | 2013-09-04 06:06:25 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-09-04 06:06:58 -0400 |
commit | 47ab1a2de42031021965b81cbab4f3b4c5696d07 (patch) | |
tree | 292df51948f1afa0277108df3001462ae6a5e3b1 /drivers/hid | |
parent | be67b68d52fa28b9b721c47bb42068f0c1214855 (diff) | |
parent | 43622021d2e2b82ea03d883926605bdd0525e1d1 (diff) |
Merge branch 'for-3.11/CVE-2013-2888' into for-3.12/upstream
This one didn't make it for 3.11 due to being applied too close
to release, queue it for 3.12 merge window.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-core.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index dcd60eb3d5ea..2ac13ca6edaa 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -63,6 +63,8 @@ struct hid_report *hid_register_report(struct hid_device *device, unsigned type, | |||
63 | struct hid_report_enum *report_enum = device->report_enum + type; | 63 | struct hid_report_enum *report_enum = device->report_enum + type; |
64 | struct hid_report *report; | 64 | struct hid_report *report; |
65 | 65 | ||
66 | if (id >= HID_MAX_IDS) | ||
67 | return NULL; | ||
66 | if (report_enum->report_id_hash[id]) | 68 | if (report_enum->report_id_hash[id]) |
67 | return report_enum->report_id_hash[id]; | 69 | return report_enum->report_id_hash[id]; |
68 | 70 | ||
@@ -404,8 +406,10 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item) | |||
404 | 406 | ||
405 | case HID_GLOBAL_ITEM_TAG_REPORT_ID: | 407 | case HID_GLOBAL_ITEM_TAG_REPORT_ID: |
406 | parser->global.report_id = item_udata(item); | 408 | parser->global.report_id = item_udata(item); |
407 | if (parser->global.report_id == 0) { | 409 | if (parser->global.report_id == 0 || |
408 | hid_err(parser->device, "report_id 0 is invalid\n"); | 410 | parser->global.report_id >= HID_MAX_IDS) { |
411 | hid_err(parser->device, "report_id %u is invalid\n", | ||
412 | parser->global.report_id); | ||
409 | return -1; | 413 | return -1; |
410 | } | 414 | } |
411 | return 0; | 415 | return 0; |
@@ -575,7 +579,7 @@ static void hid_close_report(struct hid_device *device) | |||
575 | for (i = 0; i < HID_REPORT_TYPES; i++) { | 579 | for (i = 0; i < HID_REPORT_TYPES; i++) { |
576 | struct hid_report_enum *report_enum = device->report_enum + i; | 580 | struct hid_report_enum *report_enum = device->report_enum + i; |
577 | 581 | ||
578 | for (j = 0; j < 256; j++) { | 582 | for (j = 0; j < HID_MAX_IDS; j++) { |
579 | struct hid_report *report = report_enum->report_id_hash[j]; | 583 | struct hid_report *report = report_enum->report_id_hash[j]; |
580 | if (report) | 584 | if (report) |
581 | hid_free_report(report); | 585 | hid_free_report(report); |