From: Gerd Hoffmann <kraxel@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Alexander Bulekov" <alxndr@bu.edu>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Mauro Matteo Cascella" <mcascell@redhat.com>
Subject: Re: [RFC PATCH-for-7.2 v3 3/5] hw/display/qxl: Pass requested buffer size to qxl_phys2virt()
Date: Tue, 29 Nov 2022 08:09:42 +0100 [thread overview]
Message-ID: <20221129070942.zvvnirxxnt2axvkr@sirius.home.kraxel.org> (raw)
In-Reply-To: <20221128202741.4945-4-philmd@linaro.org>
> @@ -228,7 +230,8 @@ static void qxl_unpack_chunks(void *dest, size_t size, PCIQXLDevice *qxl,
> if (offset == size) {
> return;
> }
> - chunk = qxl_phys2virt(qxl, chunk->next_chunk, group_id);
> + chunk = qxl_phys2virt(qxl, chunk->next_chunk, group_id,
> + sizeof(QXLDataChunk) + chunk->data_size);
> if (!chunk) {
> return;
> }
Not checking the first chunk?
> @@ -314,7 +318,15 @@ int qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext)
> }
> switch (cmd->type) {
> case QXL_CURSOR_SET:
> - cursor = qxl_phys2virt(qxl, cmd->u.set.shape, ext->group_id);
> + /* First read the QXLCursor to get QXLDataChunk::data_size ... */
> + cursor = qxl_phys2virt(qxl, cmd->u.set.shape, ext->group_id,
> + sizeof(QXLCursor));
> + if (!cursor) {
> + return 1;
> + }
> + /* Then read including the chunked data following QXLCursor. */
> + cursor = qxl_phys2virt(qxl, cmd->u.set.shape, ext->group_id,
> + sizeof(QXLCursor) + cursor->chunk.data_size);
> if (!cursor) {
> return 1;
> }
Ah, you do it here. Good.
Series:
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
take care,
Gerd
next prev parent reply other threads:[~2022-11-29 7:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 20:27 [RFC PATCH-for-7.2 v3 0/5] hw/display/qxl: Avoid buffer overrun in qxl_phys2virt() Philippe Mathieu-Daudé
2022-11-28 20:27 ` [PATCH-for-7.2 v3 1/5] hw/display/qxl: Have qxl_log_command Return early if no log_cmd handler Philippe Mathieu-Daudé
2022-11-28 20:27 ` [PATCH-for-7.2 v3 2/5] hw/display/qxl: Document qxl_phys2virt() Philippe Mathieu-Daudé
2022-11-28 20:27 ` [RFC PATCH-for-7.2 v3 3/5] hw/display/qxl: Pass requested buffer size to qxl_phys2virt() Philippe Mathieu-Daudé
2022-11-29 7:09 ` Gerd Hoffmann [this message]
2022-11-28 20:27 ` [RFC PATCH-for-7.2 v3 4/5] hw/display/qxl: Avoid buffer overrun in qxl_phys2virt (CVE-2022-4144) Philippe Mathieu-Daudé
2022-11-28 20:27 ` [PATCH-for-8.0 v3 5/5] hw/display/qxl: Assert memory slot fits in preallocated MemoryRegion Philippe Mathieu-Daudé
2022-11-30 19:45 ` [RFC PATCH-for-7.2 v3 0/5] hw/display/qxl: Avoid buffer overrun in qxl_phys2virt() Stefan Hajnoczi
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=20221129070942.zvvnirxxnt2axvkr@sirius.home.kraxel.org \
--to=kraxel@redhat.com \
--cc=alxndr@bu.edu \
--cc=marcandre.lureau@redhat.com \
--cc=mcascell@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.