From: Raphael Norwitz <raphael.norwitz@nutanix.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Raphael Norwitz <raphael.norwitz@nutanix.com>,
"stefanha@redhat.com" <stefanha@redhat.com>,
"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
"mst@redhat.com" <mst@redhat.com>
Subject: Re: [PATCH v2] vhost-user-blk: Fail gracefully on too large queue size
Date: Tue, 13 Apr 2021 18:23:45 +0000 [thread overview]
Message-ID: <20210413182145.GA19046@raphael-debian-dev> (raw)
In-Reply-To: <20210413165654.50810-1-kwolf@redhat.com>
On Tue, Apr 13, 2021 at 06:56:54PM +0200, Kevin Wolf wrote:
> virtio_add_queue() aborts when queue_size > VIRTQUEUE_MAX_SIZE, so
> vhost_user_blk_device_realize() should check this before calling it.
>
> Simple reproducer:
>
> qemu-system-x86_64 \
> -chardev null,id=foo \
> -device vhost-user-blk-pci,queue-size=4096,chardev=foo
>
> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1935014
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> hw/block/vhost-user-blk.c | 5 +++++
> 1 file changed, 5 insertions(+)
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
>
> diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
> index 0b5b9d44cd..f5e9682703 100644
> --- a/hw/block/vhost-user-blk.c
> +++ b/hw/block/vhost-user-blk.c
> @@ -467,6 +467,11 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)
> error_setg(errp, "vhost-user-blk: queue size must be non-zero");
> return;
> }
> + if (s->queue_size > VIRTQUEUE_MAX_SIZE) {
> + error_setg(errp, "vhost-user-blk: queue size must not exceed %d",
> + VIRTQUEUE_MAX_SIZE);
> + return;
> + }
>
> if (!vhost_user_init(&s->vhost_user, &s->chardev, errp)) {
> return;
> --
> 2.30.2
>
next prev parent reply other threads:[~2021-04-13 18:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-13 16:56 [PATCH v2] vhost-user-blk: Fail gracefully on too large queue size Kevin Wolf
2021-04-13 17:08 ` Philippe Mathieu-Daudé
2021-04-13 18:23 ` Raphael Norwitz [this message]
2021-04-14 10:37 ` Stefan Hajnoczi
2021-04-30 9:17 ` Kevin Wolf
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=20210413182145.GA19046@raphael-debian-dev \
--to=raphael.norwitz@nutanix.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).