qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: peter.maydell@linaro.org
Cc: agraf@suse.de, qemu-stable@nongnu.org, qemu-devel@nongnu.org,
	borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com,
	Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: [Qemu-devel] [PULL for-2.3 2/4] virtio-ccw: range check in READ_VQ_CONF
Date: Mon, 30 Mar 2015 10:02:25 +0200	[thread overview]
Message-ID: <1427702547-21261-3-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1427702547-21261-1-git-send-email-cornelia.huck@de.ibm.com>

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 <dahi@linux.vnet.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 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,
-- 
2.3.4

  parent reply	other threads:[~2015-03-30  8:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30  8:02 [Qemu-devel] [PULL for-2.3 0/4] s390x bugfixes for 2.3 Cornelia Huck
2015-03-30  8:02 ` [Qemu-devel] [PULL for-2.3 1/4] virtio-ccw: fix range check for SET_VQ Cornelia Huck
2015-03-30  8:02 ` Cornelia Huck [this message]
2015-03-30  8:02 ` [Qemu-devel] [PULL for-2.3 3/4] s390x: do not include ram_addr.h Cornelia Huck
2015-03-30  8:02 ` [Qemu-devel] [PULL for-2.3 4/4] s390x/ipl: avoid sign extension Cornelia Huck
2015-03-31  8:56 ` [Qemu-devel] [PULL for-2.3 0/4] s390x bugfixes for 2.3 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427702547-21261-3-git-send-email-cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).