summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2017-08-05 05:41:32 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2017-08-05 05:41:32 +0000
commit46807792e98a63b0e295e5bd25fc42d3c9d2f7f0 (patch)
tree957cf6494ef38917051fe1414fe8abd7e049ef19 /usr.sbin
parentf5060cc9df888f96711f1f5a9bf73a457022330a (diff)
vmd: report queue size of 0 when invalid queues are requested by the guest
Diff supplied by Nick Owens, who was kind enough to also point out the virtio spec section numbers that defined this behaviour.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/vmd/virtio.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/vmd/virtio.c b/usr.sbin/vmd/virtio.c
index 83238429bd4..6ac80994cd8 100644
--- a/usr.sbin/vmd/virtio.c
+++ b/usr.sbin/vmd/virtio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: virtio.c,v 1.49 2017/05/30 17:56:47 tedu Exp $ */
+/* $OpenBSD: virtio.c,v 1.50 2017/08/05 05:41:31 mlarkin Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -150,8 +150,10 @@ void
viornd_update_qs(void)
{
/* Invalid queue? */
- if (viornd.cfg.queue_select > 0)
+ if (viornd.cfg.queue_select > 0) {
+ viornd.cfg.queue_size = 0;
return;
+ }
/* Update queue address/size based on queue select */
viornd.cfg.queue_address = viornd.vq[viornd.cfg.queue_select].qa;
@@ -324,8 +326,10 @@ void
vioblk_update_qs(struct vioblk_dev *dev)
{
/* Invalid queue? */
- if (dev->cfg.queue_select > 0)
+ if (dev->cfg.queue_select > 0) {
+ dev->cfg.queue_size = 0;
return;
+ }
/* Update queue address/size based on queue select */
dev->cfg.queue_address = dev->vq[dev->cfg.queue_select].qa;
@@ -1037,8 +1041,10 @@ void
vionet_update_qs(struct vionet_dev *dev)
{
/* Invalid queue? */
- if (dev->cfg.queue_select > 1)
+ if (dev->cfg.queue_select > 1) {
+ dev->cfg.queue_size = 0;
return;
+ }
/* Update queue address/size based on queue select */
dev->cfg.queue_address = dev->vq[dev->cfg.queue_select].qa;