From patchwork Mon Mar 30 08:02:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 456001 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5184114011D for ; Mon, 30 Mar 2015 19:05:37 +1100 (AEDT) Received: from localhost ([::1]:59977 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcUhR-0003fu-Et for incoming@patchwork.ozlabs.org; Mon, 30 Mar 2015 04:05:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcUfV-0000KJ-E7 for qemu-devel@nongnu.org; Mon, 30 Mar 2015 04:03:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YcUfH-00029y-N0 for qemu-devel@nongnu.org; Mon, 30 Mar 2015 04:03:33 -0400 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:41178) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcUfH-00029U-DJ for qemu-devel@nongnu.org; Mon, 30 Mar 2015 04:03:19 -0400 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Mar 2015 09:03:18 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 30 Mar 2015 09:03:15 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 74C4F219005F; Mon, 30 Mar 2015 09:03:03 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t2U83FZH45809708; Mon, 30 Mar 2015 08:03:15 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t2U83DHY012087; Mon, 30 Mar 2015 02:03:15 -0600 Received: from gondolin.boeblingen.de.ibm.com (dyn-9-152-224-143.boeblingen.de.ibm.com [9.152.224.143]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t2U82Ytu011318; Mon, 30 Mar 2015 02:03:06 -0600 From: Cornelia Huck To: peter.maydell@linaro.org Date: Mon, 30 Mar 2015 10:02:25 +0200 Message-Id: <1427702547-21261-3-git-send-email-cornelia.huck@de.ibm.com> X-Mailer: git-send-email 2.3.4 In-Reply-To: <1427702547-21261-1-git-send-email-cornelia.huck@de.ibm.com> References: <1427702547-21261-1-git-send-email-cornelia.huck@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15033008-0013-0000-0000-000003798EF2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.109 Cc: agraf@suse.de, qemu-stable@nongnu.org, qemu-devel@nongnu.org, borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, Cornelia Huck Subject: [Qemu-devel] [PULL for-2.3 2/4] virtio-ccw: range check in READ_VQ_CONF X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- hw/s390x/virtio-ccw.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index ceb6a45..d32ecaf 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,