qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: P J P <ppandit@redhat.com>
Subject: [Qemu-devel] [PULL 09/21] vmw_pvscsi: check message ring page count at initialisation
Date: Fri,  5 May 2017 12:13:25 +0200	[thread overview]
Message-ID: <20170505101337.4650-10-pbonzini@redhat.com> (raw)
In-Reply-To: <20170505101337.4650-1-pbonzini@redhat.com>

From: P J P <ppandit@redhat.com>

A guest could set the message ring page count to zero, resulting in
infinite loop. Add check to avoid it.

Reported-by: YY Z <bigbird475958471@gmail.com>
Signed-off-by: P J P <ppandit@redhat.com>
Message-Id: <20170425130623.3649-1-ppandit@redhat.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/vmw_pvscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index 75575461e2..4a106da856 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -202,7 +202,7 @@ pvscsi_ring_init_msg(PVSCSIRingInfo *m, PVSCSICmdDescSetupMsgRing *ri)
     uint32_t len_log2;
     uint32_t ring_size;
 
-    if (ri->numPages > PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES) {
+    if (!ri->numPages || ri->numPages > PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES) {
         return -1;
     }
     ring_size = ri->numPages * PVSCSI_MAX_NUM_MSG_ENTRIES_PER_PAGE;
-- 
2.12.2

  parent reply	other threads:[~2017-05-05 10:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-05 10:13 [Qemu-devel] [PULL 00/21] Misc patches for 2017-05-05 Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 01/21] hw/i386: Use Rev3 FADT (ACPI 2.0) instead of Rev1 to improve guest OS support Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 02/21] hw/i386: Build-time assertion on pc/q35 reset register being identical Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 03/21] char: Fix removing wrong GSource that be found by fd_in_tag Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 04/21] target/i386: Add GDB XML register description support Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 05/21] use _Static_assert in QEMU_BUILD_BUG_ON Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 06/21] vl: deprecate the "-hdachs" option Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 07/21] scsi: avoid an off-by-one error in megasas_mmio_write Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 08/21] sgabios: update for "fix wrong video attrs for int 10h, ah==13h" Paolo Bonzini
2017-05-05 10:13 ` Paolo Bonzini [this message]
2017-05-05 10:13 ` [Qemu-devel] [PULL 10/21] trace: add qemu mutex lock and unlock trace events Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 11/21] checkpatch: Disallow glib asserts in main code Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 12/21] hax: Fix memory mapping de-duplication logic Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 13/21] dump: Acquire BQL around vm_start() in dump thread Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 14/21] Fix the -accel parameter and the documentation for 'hax' Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 15/21] MAINTAINERS: Add "R:" tag for self-appointed reviewers Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 16/21] get_maintainer: Teach get_maintainer.pl about the new "R:" tag Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 17/21] get_maintainer: it's '--pattern-depth', not '-pattern-depth' Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 18/21] get_maintainer: --r (list reviewer) is on by default Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 19/21] get_maintainer: add subsystem to reviewer output Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 20/21] libvhost-user: replace vasprintf() to fix build Paolo Bonzini
2017-05-05 10:13 ` [Qemu-devel] [PULL 21/21] vhost-scsi: create a vhost-scsi-common abstraction Paolo Bonzini
2017-05-30 13:11   ` Stefan Hajnoczi
2017-05-30 14:06     ` Felipe Franciosi
2017-05-30 14:16       ` Paolo Bonzini
2017-05-30 14:21         ` Felipe Franciosi
2017-05-30 14:29           ` Paolo Bonzini
2017-05-30 14:34             ` Felipe Franciosi
2017-05-08 17:02 ` [Qemu-devel] [PULL 00/21] Misc patches for 2017-05-05 Stefan Hajnoczi
2017-05-30 13:13 ` Stefan Hajnoczi

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=20170505101337.4650-10-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=ppandit@redhat.com \
    --cc=qemu-devel@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).