blob: 9fc2fafe1dc52a34593abedb102b46c0f4b25402 [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 b7afebcf9e6ecf3cf9b5a9b9b731ed04bca6aa3e Mon Sep 17 00:00:00 2001
6From: Li Qiang <liq3ea@163.com>
7Date: Sat, 15 May 2021 20:03:59 -0700
8Subject: [PATCH 4/7] vhost-user-gpu: fix memory leak while calling
9 'vg_resource_unref' (CVE-2021-3544)
10MIME-Version: 1.0
11Content-Type: text/plain; charset=UTF-8
12Content-Transfer-Encoding: 8bit
13
14If the guest trigger following sequences, the attach_backing will be leaked:
15
16 vg_resource_create_2d
17 vg_resource_attach_backing
18 vg_resource_unref
19
20This patch fix this by freeing 'res->iov' in vg_resource_destroy.
21
22Fixes: CVE-2021-3544
23Reported-by: Li Qiang <liq3ea@163.com>
24virtio-gpu fix: 5e8e3c4c75 ("virtio-gpu: fix resource leak
25in virgl_cmd_resource_unref")
26
27Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org>
28Signed-off-by: Li Qiang <liq3ea@163.com>
29Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
30Message-Id: <20210516030403.107723-5-liq3ea@163.com>
31Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
32---
33 contrib/vhost-user-gpu/vhost-user-gpu.c | 1 +
34 1 file changed, 1 insertion(+)
35
36diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
37index 0437e52b64..770dfad529 100644
38--- a/contrib/vhost-user-gpu/vhost-user-gpu.c
39+++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
40@@ -400,6 +400,7 @@ vg_resource_destroy(VuGpu *g,
41 }
42
43 vugbm_buffer_destroy(&res->buffer);
44+ g_free(res->iov);
45 pixman_image_unref(res->image);
46 QTAILQ_REMOVE(&g->reslist, res, next);
47 g_free(res);
48--
492.25.1
50