From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Li Qiang <liqiang6-s@360.cn>, Gerd Hoffmann <kraxel@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PULL 1/5] virtio-gpu: fix information leak in capset get dispatch
Date: Wed, 11 Jan 2017 11:28:33 +0100 [thread overview]
Message-ID: <1484130518-18873-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1484130518-18873-1-git-send-email-kraxel@redhat.com>
From: Li Qiang <liqiang6-s@360.cn>
In virgl_cmd_get_capset function, it uses g_malloc to allocate
a response struct to the guest. As the 'resp'struct hasn't been full
initialized it will lead the 'resp->padding' field to the guest.
Use g_malloc0 to avoid this.
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 58188cae.4a6ec20a.3d2d1.aff2@mx.google.com
[ kraxel: resolved conflict ]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/display/virtio-gpu-3d.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index b13ced3..f96a0c2 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -379,7 +379,7 @@ static void virgl_cmd_get_capset(VirtIOGPU *g,
return;
}
- resp = g_malloc(sizeof(*resp) + max_size);
+ resp = g_malloc0(sizeof(*resp) + max_size);
resp->hdr.type = VIRTIO_GPU_RESP_OK_CAPSET;
virgl_renderer_fill_caps(gc.capset_id,
gc.capset_version,
--
1.8.3.1
next prev parent reply other threads:[~2017-01-11 10:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-11 10:28 [Qemu-devel] [PULL 0/5] vga patch queue Gerd Hoffmann
2017-01-11 10:28 ` Gerd Hoffmann [this message]
2017-01-11 10:28 ` [Qemu-devel] [PULL 2/5] display: cirrus: ignore source pitch value as needed in blit_is_unsafe Gerd Hoffmann
2017-01-11 10:28 ` [Qemu-devel] [PULL 3/5] virtio-gpu: Recalculate VirtIOGPU::hostmem on VM load Gerd Hoffmann
2017-01-11 10:28 ` [Qemu-devel] [PULL 4/5] virtio-gpu: Fix memory leak in virtio_gpu_load() Gerd Hoffmann
2017-01-11 10:28 ` [Qemu-devel] [PULL 5/5] virtio-gpu: tag as not hotpluggable Gerd Hoffmann
2017-01-12 18:29 ` [Qemu-devel] [PULL 0/5] vga patch queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1484130518-18873-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=liqiang6-s@360.cn \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).