* [PATCH v2] vhost-user-blk: Fail gracefully on too large queue size
@ 2021-04-13 16:56 Kevin Wolf
2021-04-13 17:08 ` Philippe Mathieu-Daudé
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Kevin Wolf @ 2021-04-13 16:56 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, raphael.norwitz, qemu-devel, stefanha, mst
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(+)
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] vhost-user-blk: Fail gracefully on too large queue size
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
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-04-13 17:08 UTC (permalink / raw)
To: Kevin Wolf, qemu-block; +Cc: mst, qemu-devel, stefanha, raphael.norwitz
On 4/13/21 6:56 PM, 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: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] vhost-user-blk: Fail gracefully on too large queue size
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
2021-04-14 10:37 ` Stefan Hajnoczi
2021-04-30 9:17 ` Kevin Wolf
3 siblings, 0 replies; 5+ messages in thread
From: Raphael Norwitz @ 2021-04-13 18:23 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel, Raphael Norwitz, stefanha, qemu-block, mst
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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] vhost-user-blk: Fail gracefully on too large queue size
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
@ 2021-04-14 10:37 ` Stefan Hajnoczi
2021-04-30 9:17 ` Kevin Wolf
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2021-04-14 10:37 UTC (permalink / raw)
To: Kevin Wolf; +Cc: raphael.norwitz, qemu-devel, qemu-block, mst
[-- Attachment #1: Type: text/plain, Size: 600 bytes --]
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: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] vhost-user-blk: Fail gracefully on too large queue size
2021-04-13 16:56 [PATCH v2] vhost-user-blk: Fail gracefully on too large queue size Kevin Wolf
` (2 preceding siblings ...)
2021-04-14 10:37 ` Stefan Hajnoczi
@ 2021-04-30 9:17 ` Kevin Wolf
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2021-04-30 9:17 UTC (permalink / raw)
To: qemu-block; +Cc: raphael.norwitz, qemu-devel, stefanha, mst
Am 13.04.2021 um 18:56 hat Kevin Wolf geschrieben:
> 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>
Thanks for the review, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-04-30 9:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-04-14 10:37 ` Stefan Hajnoczi
2021-04-30 9:17 ` Kevin Wolf
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).