diff options
-rw-r--r-- | patches/cve/CVE-2017-16531.patch | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/patches/cve/CVE-2017-16531.patch b/patches/cve/CVE-2017-16531.patch new file mode 100644 index 0000000..bc8d2c5 --- /dev/null +++ b/patches/cve/CVE-2017-16531.patch | |||
@@ -0,0 +1,77 @@ | |||
1 | From de5ffcc63dbdaffffd93934003fd527673f4da0a Mon Sep 17 00:00:00 2001 | ||
2 | From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
3 | Date: Tue, 19 Sep 2017 15:07:17 +0200 | ||
4 | Subject: USB: fix out-of-bounds in usb_set_configuration | ||
5 | |||
6 | [ Upstream commit bd7a3fe770ebd8391d1c7d072ff88e9e76d063eb ] | ||
7 | |||
8 | Andrey Konovalov reported a possible out-of-bounds problem for a USB interface | ||
9 | association descriptor. He writes: | ||
10 | It seems there's no proper size check of a USB_DT_INTERFACE_ASSOCIATION | ||
11 | descriptor. It's only checked that the size is >= 2 in | ||
12 | usb_parse_configuration(), so find_iad() might do out-of-bounds access | ||
13 | to intf_assoc->bInterfaceCount. | ||
14 | |||
15 | And he's right, we don't check for crazy descriptors of this type very well, so | ||
16 | resolve this problem. Yet another issue found by syzkaller... | ||
17 | |||
18 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.1.y&id=de5ffcc63dbdaffffd93934003fd527673f4da0a] | ||
19 | CVE: CVE-2017-16531 | ||
20 | |||
21 | Reported-by: Andrey Konovalov <andreyknvl@google.com> | ||
22 | Tested-by: Andrey Konovalov <andreyknvl@google.com> | ||
23 | Cc: stable <stable@vger.kernel.org> | ||
24 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
25 | Signed-off-by: Sasha Levin <alexander.levin@verizon.com> | ||
26 | Signed-off-by: Adrian Stratulat <adrian.stratulat@enea.com> | ||
27 | --- | ||
28 | drivers/usb/core/config.c | 14 +++++++++++--- | ||
29 | include/uapi/linux/usb/ch9.h | 1 + | ||
30 | 2 files changed, 12 insertions(+), 3 deletions(-) | ||
31 | |||
32 | diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c | ||
33 | index b48fac6e4b40..510e7158b502 100644 | ||
34 | --- a/drivers/usb/core/config.c | ||
35 | +++ b/drivers/usb/core/config.c | ||
36 | @@ -528,15 +528,23 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, | ||
37 | |||
38 | } else if (header->bDescriptorType == | ||
39 | USB_DT_INTERFACE_ASSOCIATION) { | ||
40 | + struct usb_interface_assoc_descriptor *d; | ||
41 | + | ||
42 | + d = (struct usb_interface_assoc_descriptor *)header; | ||
43 | + if (d->bLength < USB_DT_INTERFACE_ASSOCIATION_SIZE) { | ||
44 | + dev_warn(ddev, | ||
45 | + "config %d has an invalid interface association descriptor of length %d, skipping\n", | ||
46 | + cfgno, d->bLength); | ||
47 | + continue; | ||
48 | + } | ||
49 | + | ||
50 | if (iad_num == USB_MAXIADS) { | ||
51 | dev_warn(ddev, "found more Interface " | ||
52 | "Association Descriptors " | ||
53 | "than allocated for in " | ||
54 | "configuration %d\n", cfgno); | ||
55 | } else { | ||
56 | - config->intf_assoc[iad_num] = | ||
57 | - (struct usb_interface_assoc_descriptor | ||
58 | - *)header; | ||
59 | + config->intf_assoc[iad_num] = d; | ||
60 | iad_num++; | ||
61 | } | ||
62 | |||
63 | diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h | ||
64 | index aa33fd1b2d4f..400196c45b3c 100644 | ||
65 | --- a/include/uapi/linux/usb/ch9.h | ||
66 | +++ b/include/uapi/linux/usb/ch9.h | ||
67 | @@ -705,6 +705,7 @@ struct usb_interface_assoc_descriptor { | ||
68 | __u8 iFunction; | ||
69 | } __attribute__ ((packed)); | ||
70 | |||
71 | +#define USB_DT_INTERFACE_ASSOCIATION_SIZE 8 | ||
72 | |||
73 | /*-------------------------------------------------------------------------*/ | ||
74 | |||
75 | -- | ||
76 | cgit 1.2-0.3.lf.el7 | ||
77 | |||