diff options
Diffstat (limited to 'recipes-kernel/linux/files/0002-HID-CVE-2014-3182.patch')
-rw-r--r-- | recipes-kernel/linux/files/0002-HID-CVE-2014-3182.patch | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/recipes-kernel/linux/files/0002-HID-CVE-2014-3182.patch b/recipes-kernel/linux/files/0002-HID-CVE-2014-3182.patch new file mode 100644 index 0000000..a90d079 --- /dev/null +++ b/recipes-kernel/linux/files/0002-HID-CVE-2014-3182.patch | |||
@@ -0,0 +1,65 @@ | |||
1 | From ad3e14d7c5268c2e24477c6ef54bbdf88add5d36 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jiri Kosina <jkosina@suse.cz> | ||
3 | Date: Thu, 21 Aug 2014 09:57:17 -0500 | ||
4 | Subject: [PATCH] HID: logitech: perform bounds checking on device_id early | ||
5 | enough | ||
6 | |||
7 | device_index is a char type and the size of paired_dj_deivces is 7 | ||
8 | elements, therefore proper bounds checking has to be applied to | ||
9 | device_index before it is used. | ||
10 | |||
11 | We are currently performing the bounds checking in | ||
12 | logi_dj_recv_add_djhid_device(), which is too late, as malicious device | ||
13 | could send REPORT_TYPE_NOTIF_DEVICE_UNPAIRED early enough and trigger the | ||
14 | problem in one of the report forwarding functions called from | ||
15 | logi_dj_raw_event(). | ||
16 | |||
17 | Fix this by performing the check at the earliest possible ocasion in | ||
18 | logi_dj_raw_event(). | ||
19 | |||
20 | This fixes CVE-2014-3182 | ||
21 | Upstream-Status: Backport | ||
22 | |||
23 | Cc: stable@vger.kernel.org | ||
24 | Reported-by: Ben Hawkes <hawkes@google.com> | ||
25 | Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> | ||
26 | Signed-off-by: Jiri Kosina <jkosina@suse.cz> | ||
27 | Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com> | ||
28 | --- | ||
29 | drivers/hid/hid-logitech-dj.c | 13 ++++++------- | ||
30 | 1 file changed, 6 insertions(+), 7 deletions(-) | ||
31 | |||
32 | diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c | ||
33 | index ca0ab51..b7ba829 100644 | ||
34 | --- a/drivers/hid/hid-logitech-dj.c | ||
35 | +++ b/drivers/hid/hid-logitech-dj.c | ||
36 | @@ -238,13 +238,6 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, | ||
37 | return; | ||
38 | } | ||
39 | |||
40 | - if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || | ||
41 | - (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { | ||
42 | - dev_err(&djrcv_hdev->dev, "%s: invalid device index:%d\n", | ||
43 | - __func__, dj_report->device_index); | ||
44 | - return; | ||
45 | - } | ||
46 | - | ||
47 | if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { | ||
48 | /* The device is already known. No need to reallocate it. */ | ||
49 | dbg_hid("%s: device is already known\n", __func__); | ||
50 | @@ -690,6 +683,12 @@ static int logi_dj_raw_event(struct hid_device *hdev, | ||
51 | * device (via hid_input_report() ) and return 1 so hid-core does not do | ||
52 | * anything else with it. | ||
53 | */ | ||
54 | + if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || | ||
55 | + (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { | ||
56 | + dev_err(&hdev->dev, "%s: invalid device index:%d\n", | ||
57 | + __func__, dj_report->device_index); | ||
58 | + return false; | ||
59 | + } | ||
60 | |||
61 | spin_lock_irqsave(&djrcv_dev->lock, flags); | ||
62 | if (dj_report->report_id == REPORT_ID_DJ_SHORT) { | ||
63 | -- | ||
64 | 1.9.1 | ||
65 | |||