Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame^] | 1 | CVE: CVE-2021-3544 |
| 2 | Upstream-Status: Backport |
| 3 | Signed-off-by: Ross Burton <ross.burton@arm.com> |
| 4 | |
| 5 | From b7afebcf9e6ecf3cf9b5a9b9b731ed04bca6aa3e Mon Sep 17 00:00:00 2001 |
| 6 | From: Li Qiang <liq3ea@163.com> |
| 7 | Date: Sat, 15 May 2021 20:03:59 -0700 |
| 8 | Subject: [PATCH 4/7] vhost-user-gpu: fix memory leak while calling |
| 9 | 'vg_resource_unref' (CVE-2021-3544) |
| 10 | MIME-Version: 1.0 |
| 11 | Content-Type: text/plain; charset=UTF-8 |
| 12 | Content-Transfer-Encoding: 8bit |
| 13 | |
| 14 | If 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 | |
| 20 | This patch fix this by freeing 'res->iov' in vg_resource_destroy. |
| 21 | |
| 22 | Fixes: CVE-2021-3544 |
| 23 | Reported-by: Li Qiang <liq3ea@163.com> |
| 24 | virtio-gpu fix: 5e8e3c4c75 ("virtio-gpu: fix resource leak |
| 25 | in virgl_cmd_resource_unref") |
| 26 | |
| 27 | Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org> |
| 28 | Signed-off-by: Li Qiang <liq3ea@163.com> |
| 29 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> |
| 30 | Message-Id: <20210516030403.107723-5-liq3ea@163.com> |
| 31 | Signed-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 | |
| 36 | diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c |
| 37 | index 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 | -- |
| 49 | 2.25.1 |
| 50 | |