blob: 5efb87ca33a2ac78ecba77e003b95c48e357b47a [file] [log] [blame]
Andrew Geissler09036742021-06-25 14:25:14 -05001CVE: CVE-2021-3544
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From 63736af5a6571d9def93769431e0d7e38c6677bf Mon Sep 17 00:00:00 2001
6From: Li Qiang <liq3ea@163.com>
7Date: Sat, 15 May 2021 20:04:01 -0700
8Subject: [PATCH 6/7] vhost-user-gpu: fix memory leak in
9 'virgl_resource_attach_backing' (CVE-2021-3544)
10MIME-Version: 1.0
11Content-Type: text/plain; charset=UTF-8
12Content-Transfer-Encoding: 8bit
13
14If 'virgl_renderer_resource_attach_iov' failed, the 'res_iovs' will
15be leaked.
16
17Fixes: CVE-2021-3544
18Reported-by: Li Qiang <liq3ea@163.com>
19virtio-gpu fix: 33243031da ("virtio-gpu-3d: 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-7-liq3ea@163.com>
25Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
26---
27 contrib/vhost-user-gpu/virgl.c | 5 ++++-
28 1 file changed, 4 insertions(+), 1 deletion(-)
29
30diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c
31index c669d73a1d..a16a311d80 100644
32--- a/contrib/vhost-user-gpu/virgl.c
33+++ b/contrib/vhost-user-gpu/virgl.c
34@@ -287,8 +287,11 @@ virgl_resource_attach_backing(VuGpu *g,
35 return;
36 }
37
38- virgl_renderer_resource_attach_iov(att_rb.resource_id,
39+ ret = virgl_renderer_resource_attach_iov(att_rb.resource_id,
40 res_iovs, att_rb.nr_entries);
41+ if (ret != 0) {
42+ g_free(res_iovs);
43+ }
44 }
45
46 static void
47--
482.25.1
49