[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 7/8] vhost-user-gpu: fix OOB write in 'virgl_cmd_get_capset' (
From: |
Li Qiang |
Subject: |
[PATCH v2 7/8] vhost-user-gpu: fix OOB write in 'virgl_cmd_get_capset' (CVE-2021-3546) |
Date: |
Sat, 15 May 2021 20:04:02 -0700 |
If 'virgl_cmd_get_capset' set 'max_size' to 0,
the 'virgl_renderer_fill_caps' will write the data after the 'resp'.
This patch avoid this by checking the returned 'max_size'.
virtio-gpu fix: abd7f08b23 ("display: virtio-gpu-3d: check
virgl capabilities max_size")
Fixes: CVE-2021-3546
Reported-by: Li Qiang <liq3ea@163.com>
Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Li Qiang <liq3ea@163.com>
---
contrib/vhost-user-gpu/virgl.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c
index a16a311d80..7172104b19 100644
--- a/contrib/vhost-user-gpu/virgl.c
+++ b/contrib/vhost-user-gpu/virgl.c
@@ -177,6 +177,10 @@ virgl_cmd_get_capset(VuGpu *g,
virgl_renderer_get_cap_set(gc.capset_id, &max_ver,
&max_size);
+ if (!max_size) {
+ cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;
+ return;
+ }
resp = g_malloc0(sizeof(*resp) + max_size);
resp->hdr.type = VIRTIO_GPU_RESP_OK_CAPSET;
--
2.25.1
- [PATCH v2 0/8] vhost-user-gpu: fix several security issues, Li Qiang, 2021/05/15
- [PATCH v2 3/8] vhost-user-gpu: fix memory leak in vg_resource_attach_backing (CVE-2021-3544), Li Qiang, 2021/05/15
- [PATCH v2 8/8] vhost-user-gpu: abstract vg_cleanup_mapping_iov, Li Qiang, 2021/05/15
- [PATCH v2 6/8] vhost-user-gpu: fix memory leak in 'virgl_resource_attach_backing' (CVE-2021-3544), Li Qiang, 2021/05/15
- [PATCH v2 4/8] vhost-user-gpu: fix memory leak while calling 'vg_resource_unref' (CVE-2021-3544), Li Qiang, 2021/05/15
- [PATCH v2 1/8] vhost-user-gpu: fix memory disclosure in virgl_cmd_get_capset_info (CVE-2021-3545), Li Qiang, 2021/05/15
- [PATCH v2 5/8] vhost-user-gpu: fix memory leak in 'virgl_cmd_resource_unref' (CVE-2021-3544), Li Qiang, 2021/05/15
- [PATCH v2 2/8] vhost-user-gpu: fix resource leak in 'vg_resource_create_2d' (CVE-2021-3544), Li Qiang, 2021/05/15
- [PATCH v2 7/8] vhost-user-gpu: fix OOB write in 'virgl_cmd_get_capset' (CVE-2021-3546),
Li Qiang <=
- Re: [PATCH v2 0/8] vhost-user-gpu: fix several security issues, Marc-André Lureau, 2021/05/16
- Re: [PATCH v2 0/8] vhost-user-gpu: fix several security issues, Gerd Hoffmann, 2021/05/18