From: Cornelia Huck Date: Fri, 20 Mar 2015 12:16:20 +0000 (+0100) Subject: virtio-ccw: range check in READ_VQ_CONF X-Git-Tag: v2.3.0-rc2~12^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d03a363054f1cc58d4e6653ff09fbbe8121a0302;p=thirdparty%2Fqemu.git virtio-ccw: range check in READ_VQ_CONF Processing for READ_VQ_CONF needs to check whether the requested queue value is actually in the supported range and post a channel program check if not. Cc: qemu-stable@nongnu.org Reviewed-by: David Hildenbrand Acked-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index ceb6a457035..d32ecafe981 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -549,6 +549,10 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) ret = -EFAULT; } else { vq_config.index = lduw_be_phys(&address_space_memory, ccw.cda); + if (vq_config.index >= VIRTIO_PCI_QUEUE_MAX) { + ret = -EINVAL; + break; + } vq_config.num_max = virtio_queue_get_num(vdev, vq_config.index); stw_be_phys(&address_space_memory,