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 63736af5a6571d9def93769431e0d7e38c6677bf Mon Sep 17 00:00:00 2001 |
| 6 | From: Li Qiang <liq3ea@163.com> |
| 7 | Date: Sat, 15 May 2021 20:04:01 -0700 |
| 8 | Subject: [PATCH 6/7] vhost-user-gpu: fix memory leak in |
| 9 | 'virgl_resource_attach_backing' (CVE-2021-3544) |
| 10 | MIME-Version: 1.0 |
| 11 | Content-Type: text/plain; charset=UTF-8 |
| 12 | Content-Transfer-Encoding: 8bit |
| 13 | |
| 14 | If 'virgl_renderer_resource_attach_iov' failed, the 'res_iovs' will |
| 15 | be leaked. |
| 16 | |
| 17 | Fixes: CVE-2021-3544 |
| 18 | Reported-by: Li Qiang <liq3ea@163.com> |
| 19 | virtio-gpu fix: 33243031da ("virtio-gpu-3d: fix memory leak |
| 20 | in resource attach backing") |
| 21 | |
| 22 | Signed-off-by: Li Qiang <liq3ea@163.com> |
| 23 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> |
| 24 | Message-Id: <20210516030403.107723-7-liq3ea@163.com> |
| 25 | Signed-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 | |
| 30 | diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c |
| 31 | index 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 | -- |
| 48 | 2.25.1 |
| 49 | |