Patchwork virtio-ccw: Queue sanity check for notify hypercall.

login
register
mail settings
Submitter Cornelia Huck
Date March 26, 2013, 5:09 p.m.
Message ID <1364317746-19166-2-git-send-email-cornelia.huck@de.ibm.com>
Download mbox | patch
Permalink /patch/231480/
State New
Headers show

Comments

Cornelia Huck - March 26, 2013, 5:09 p.m.
Verify that the virtio-ccw notify hypercall passed a reasonable
value for queue.

Cc: qemu-stable@nongnu.org
Reported-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 hw/s390x/s390-virtio-ccw.c |    3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index d436414..76b63e2 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -31,6 +31,9 @@  static int virtio_ccw_hcall_notify(const uint64_t *args)
     if (!sch || !css_subch_visible(sch)) {
         return -EINVAL;
     }
+    if (queue >= VIRTIO_PCI_QUEUE_MAX) {
+        return -EINVAL;
+    }
     virtio_queue_notify(virtio_ccw_get_vdev(sch), queue);
     return 0;