diff options
Diffstat (limited to 'recipes-kernel/linux/files/HID_CVE_patches/0011-HID-multitouch-validate-indexes-details.patch')
-rw-r--r-- | recipes-kernel/linux/files/HID_CVE_patches/0011-HID-multitouch-validate-indexes-details.patch | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/recipes-kernel/linux/files/HID_CVE_patches/0011-HID-multitouch-validate-indexes-details.patch b/recipes-kernel/linux/files/HID_CVE_patches/0011-HID-multitouch-validate-indexes-details.patch deleted file mode 100644 index ff425ec..0000000 --- a/recipes-kernel/linux/files/HID_CVE_patches/0011-HID-multitouch-validate-indexes-details.patch +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | From 8821f5dc187bdf16cfb32ef5aa8c3035273fa79a Mon Sep 17 00:00:00 2001 | ||
2 | From: Benjamin Tissoires <benjamin.tissoires@redhat.com> | ||
3 | Date: Wed, 11 Sep 2013 21:56:58 +0200 | ||
4 | Subject: [PATCH] HID: multitouch: validate indexes details | ||
5 | |||
6 | When working on report indexes, always validate that they are in bounds. | ||
7 | Without this, a HID device could report a malicious feature report that | ||
8 | could trick the driver into a heap overflow: | ||
9 | |||
10 | [ 634.885003] usb 1-1: New USB device found, idVendor=0596, idProduct=0500 | ||
11 | ... | ||
12 | [ 676.469629] BUG kmalloc-192 (Tainted: G W ): Redzone overwritten | ||
13 | |||
14 | Note that we need to change the indexes from s8 to s16 as they can | ||
15 | be between -1 and 255. | ||
16 | |||
17 | CVE-2013-2897 | ||
18 | |||
19 | Cc: stable@vger.kernel.org | ||
20 | Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> | ||
21 | Acked-by: Kees Cook <keescook@chromium.org> | ||
22 | Signed-off-by: Jiri Kosina <jkosina@suse.cz> | ||
23 | Signed-off-by: Adrian Dudau <adrian.dudau@enea.com> | ||
24 | --- | ||
25 | drivers/hid/hid-multitouch.c | 26 ++++++++++++++------------ | ||
26 | 1 file changed, 14 insertions(+), 12 deletions(-) | ||
27 | |||
28 | diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c | ||
29 | index ac28f08..5e5fe1b 100644 | ||
30 | --- a/drivers/hid/hid-multitouch.c | ||
31 | +++ b/drivers/hid/hid-multitouch.c | ||
32 | @@ -101,9 +101,9 @@ struct mt_device { | ||
33 | unsigned last_slot_field; /* the last field of a slot */ | ||
34 | unsigned mt_report_id; /* the report ID of the multitouch device */ | ||
35 | unsigned pen_report_id; /* the report ID of the pen device */ | ||
36 | - __s8 inputmode; /* InputMode HID feature, -1 if non-existent */ | ||
37 | - __s8 inputmode_index; /* InputMode HID feature index in the report */ | ||
38 | - __s8 maxcontact_report_id; /* Maximum Contact Number HID feature, | ||
39 | + __s16 inputmode; /* InputMode HID feature, -1 if non-existent */ | ||
40 | + __s16 inputmode_index; /* InputMode HID feature index in the report */ | ||
41 | + __s16 maxcontact_report_id; /* Maximum Contact Number HID feature, | ||
42 | -1 if non-existent */ | ||
43 | __u8 num_received; /* how many contacts we received */ | ||
44 | __u8 num_expected; /* expected last contact index */ | ||
45 | @@ -312,20 +312,18 @@ static void mt_feature_mapping(struct hid_device *hdev, | ||
46 | struct hid_field *field, struct hid_usage *usage) | ||
47 | { | ||
48 | struct mt_device *td = hid_get_drvdata(hdev); | ||
49 | - int i; | ||
50 | |||
51 | switch (usage->hid) { | ||
52 | case HID_DG_INPUTMODE: | ||
53 | - td->inputmode = field->report->id; | ||
54 | - td->inputmode_index = 0; /* has to be updated below */ | ||
55 | - | ||
56 | - for (i=0; i < field->maxusage; i++) { | ||
57 | - if (field->usage[i].hid == usage->hid) { | ||
58 | - td->inputmode_index = i; | ||
59 | - break; | ||
60 | - } | ||
61 | + /* Ignore if value index is out of bounds. */ | ||
62 | + if (usage->usage_index >= field->report_count) { | ||
63 | + dev_err(&hdev->dev, "HID_DG_INPUTMODE out of range\n"); | ||
64 | + break; | ||
65 | } | ||
66 | |||
67 | + td->inputmode = field->report->id; | ||
68 | + td->inputmode_index = usage->usage_index; | ||
69 | + | ||
70 | break; | ||
71 | case HID_DG_CONTACTMAX: | ||
72 | td->maxcontact_report_id = field->report->id; | ||
73 | @@ -511,6 +509,10 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
74 | mt_store_field(usage, td, hi); | ||
75 | return 1; | ||
76 | case HID_DG_CONTACTCOUNT: | ||
77 | + /* Ignore if indexes are out of bounds. */ | ||
78 | + if (field->index >= field->report->maxfield || | ||
79 | + usage->usage_index >= field->report_count) | ||
80 | + return 1; | ||
81 | td->cc_index = field->index; | ||
82 | td->cc_value_index = usage->usage_index; | ||
83 | return 1; | ||
84 | -- | ||
85 | 1.7.9.5 | ||
86 | |||