Received: from eggs.gnu.org ([208.118.235.92]:32836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKXNB-0008E9-D9 for qemu-devel@nongnu.org; Tue, 26 Mar 2013 13:09:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKXN8-0007R6-OP for qemu-devel@nongnu.org; Tue, 26 Mar 2013 13:09:21 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:59656) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKXN8-0007Qf-Gc for qemu-devel@nongnu.org; Tue, 26 Mar 2013 13:09:18 -0400 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 26 Mar 2013 17:06:44 -0000 From: Cornelia Huck Date: Tue, 26 Mar 2013 18:09:06 +0100 Message-Id: <1364317746-19166-2-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1364317746-19166-1-git-send-email-cornelia.huck@de.ibm.com> References: <1364317746-19166-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PATCH] virtio-ccw: Queue sanity check for notify hypercall. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: Blue Swirl , Anthony Liguori , Alexander Graf , =?UTF-8?q?Aur=C3=A9lien=20Jarno?= , qemu-stable@nongnu.org Verify that the virtio-ccw notify hypercall passed a reasonable value for queue. Cc: qemu-stable@nongnu.org Reported-by: Alexander Graf Signed-off-by: Cornelia Huck --- hw/s390x/s390-virtio-ccw.c | 3 +++ 1 file changed, 3 insertions(+) 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; -- 1.7.9.5