summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-devtools/qemu/qemu/CVE-2017-6505.patch56
-rw-r--r--recipes-devtools/qemu/qemu_%.bbappend1
2 files changed, 57 insertions, 0 deletions
diff --git a/recipes-devtools/qemu/qemu/CVE-2017-6505.patch b/recipes-devtools/qemu/qemu/CVE-2017-6505.patch
new file mode 100644
index 0000000..a939e85
--- /dev/null
+++ b/recipes-devtools/qemu/qemu/CVE-2017-6505.patch
@@ -0,0 +1,56 @@
1From 95ed56939eb2eaa4e2f349fe6dcd13ca4edfd8fb Mon Sep 17 00:00:00 2001
2From: Li Qiang <liqiang6-s@360.cn>
3Date: Tue, 7 Feb 2017 02:23:33 -0800
4Subject: [PATCH] usb: ohci: limit the number of link eds
5
6The guest may builds an infinite loop with link eds. This patch
7limit the number of linked ed to avoid this.
8
9CVE: CVE-2017-6505
10Upstream-Status: Backport [backport from v2.9.0-rc0~85^2~8]
11
12Signed-off-by: Li Qiang <liqiang6-s@360.cn>
13Message-id: 5899a02e.45ca240a.6c373.93c1@mx.google.com
14Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
16---
17 hw/usb/hcd-ohci.c | 9 ++++++++-
18 1 file changed, 8 insertions(+), 1 deletion(-)
19
20diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
21index 2cba3e3..21c93e0 100644
22--- a/hw/usb/hcd-ohci.c
23+++ b/hw/usb/hcd-ohci.c
24@@ -42,6 +42,8 @@
25
26 #define OHCI_MAX_PORTS 15
27
28+#define ED_LINK_LIMIT 4
29+
30 static int64_t usb_frame_time;
31 static int64_t usb_bit_time;
32
33@@ -1184,7 +1186,7 @@ static int ohci_service_ed_list(OHCIState *ohci, uint32_t head, int completion)
34 uint32_t next_ed;
35 uint32_t cur;
36 int active;
37-
38+ uint32_t link_cnt = 0;
39 active = 0;
40
41 if (head == 0)
42@@ -1199,6 +1201,11 @@ static int ohci_service_ed_list(OHCIState *ohci, uint32_t head, int completion)
43
44 next_ed = ed.next & OHCI_DPTR_MASK;
45
46+ if (++link_cnt > ED_LINK_LIMIT) {
47+ ohci_die(ohci);
48+ return 0;
49+ }
50+
51 if ((ed.head & OHCI_ED_H) || (ed.flags & OHCI_ED_K)) {
52 uint32_t addr;
53 /* Cancel pending packets for ED that have been paused. */
54--
551.9.1
56
diff --git a/recipes-devtools/qemu/qemu_%.bbappend b/recipes-devtools/qemu/qemu_%.bbappend
index 8a73d1f..8db32c5 100644
--- a/recipes-devtools/qemu/qemu_%.bbappend
+++ b/recipes-devtools/qemu/qemu_%.bbappend
@@ -4,4 +4,5 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
4SRC_URI += "file://0001-CVE-2017-2620.patch \ 4SRC_URI += "file://0001-CVE-2017-2620.patch \
5 file://0002-CVE-2017-2620.patch \ 5 file://0002-CVE-2017-2620.patch \
6 file://CVE-2017-7471.patch \ 6 file://CVE-2017-7471.patch \
7 file://CVE-2017-6505.patch \
7 " 8 "