summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu/qemu/0003-vhost-user-gpu-fix-memory-leak-in-vg_resource_attach.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/0003-vhost-user-gpu-fix-memory-leak-in-vg_resource_attach.patch')
-rw-r--r--meta/recipes-devtools/qemu/qemu/0003-vhost-user-gpu-fix-memory-leak-in-vg_resource_attach.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/0003-vhost-user-gpu-fix-memory-leak-in-vg_resource_attach.patch b/meta/recipes-devtools/qemu/qemu/0003-vhost-user-gpu-fix-memory-leak-in-vg_resource_attach.patch
new file mode 100644
index 0000000000..1718486405
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/0003-vhost-user-gpu-fix-memory-leak-in-vg_resource_attach.patch
@@ -0,0 +1,48 @@
1CVE: CVE-2021-3544
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From b9f79858a614d95f5de875d0ca31096eaab72c3b Mon Sep 17 00:00:00 2001
6From: Li Qiang <liq3ea@163.com>
7Date: Sat, 15 May 2021 20:03:58 -0700
8Subject: [PATCH 3/7] vhost-user-gpu: fix memory leak in
9 vg_resource_attach_backing (CVE-2021-3544)
10MIME-Version: 1.0
11Content-Type: text/plain; charset=UTF-8
12Content-Transfer-Encoding: 8bit
13
14Check whether the 'res' has already been attach_backing to avoid
15memory leak.
16
17Fixes: CVE-2021-3544
18Reported-by: Li Qiang <liq3ea@163.com>
19virtio-gpu fix: 204f01b309 ("virtio-gpu: fix memory leak
20in resource attach backing")
21
22Signed-off-by: Li Qiang <liq3ea@163.com>
23Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
24Message-Id: <20210516030403.107723-4-liq3ea@163.com>
25Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
26---
27 contrib/vhost-user-gpu/vhost-user-gpu.c | 5 +++++
28 1 file changed, 5 insertions(+)
29
30diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
31index b5e153d0d6..0437e52b64 100644
32--- a/contrib/vhost-user-gpu/vhost-user-gpu.c
33+++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
34@@ -489,6 +489,11 @@ vg_resource_attach_backing(VuGpu *g,
35 return;
36 }
37
38+ if (res->iov) {
39+ cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
40+ return;
41+ }
42+
43 ret = vg_create_mapping_iov(g, &ab, cmd, &res->iov);
44 if (ret != 0) {
45 cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
46--
472.25.1
48