summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu/qemu/CVE-2020-35504.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/CVE-2020-35504.patch')
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2020-35504.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-35504.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-35504.patch
new file mode 100644
index 0000000000..97d32589d8
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-35504.patch
@@ -0,0 +1,51 @@
1Backport of:
2
3From 0db895361b8a82e1114372ff9f4857abea605701 Mon Sep 17 00:00:00 2001
4From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
5Date: Wed, 7 Apr 2021 20:57:50 +0100
6Subject: [PATCH] esp: always check current_req is not NULL before use in DMA
7 callbacks
8
9After issuing a SCSI command the SCSI layer can call the SCSIBusInfo .cancel
10callback which resets both current_req and current_dev to NULL. If any data
11is left in the transfer buffer (async_len != 0) then the next TI (Transfer
12Information) command will attempt to reference the NULL pointer causing a
13segfault.
14
15Buglink: https://bugs.launchpad.net/qemu/+bug/1910723
16Buglink: https://bugs.launchpad.net/qemu/+bug/1909247
17Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
18Tested-by: Alexander Bulekov <alxndr@bu.edu>
19Message-Id: <20210407195801.685-2-mark.cave-ayland@ilande.co.uk>
20
21CVE: CVE-2020-35504
22Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/qemu/tree/debian/patches/CVE-2020-35504.patch?h=ubuntu/focal-security Upstream commit https://github.com/qemu/qemu/commit/0db895361b8a82e1114372ff9f4857abea605701 ]
23Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
24---
25 hw/scsi/esp.c | 19 ++++++++++++++-----
26 1 file changed, 14 insertions(+), 5 deletions(-)
27
28--- a/hw/scsi/esp.c
29+++ b/hw/scsi/esp.c
30@@ -362,6 +362,11 @@ static void do_dma_pdma_cb(ESPState *s)
31 do_cmd(s, s->cmdbuf);
32 return;
33 }
34+
35+ if (!s->current_req) {
36+ return;
37+ }
38+
39 s->dma_left -= len;
40 s->async_buf += len;
41 s->async_len -= len;
42@@ -415,6 +420,9 @@ static void esp_do_dma(ESPState *s)
43 do_cmd(s, s->cmdbuf);
44 return;
45 }
46+ if (!s->current_req) {
47+ return;
48+ }
49 if (s->async_len == 0) {
50 /* Defer until data is available. */
51 return;