dcavalca / rpms / qemu

Forked from rpms/qemu 11 months ago
Clone

Blame 0001-vmw_pvscsi-check-message-ring-page-count-at-initiali.patch

335584
From: P J P <ppandit@redhat.com>
335584
Date: Tue, 25 Apr 2017 18:36:23 +0530
335584
Subject: [PATCH] vmw_pvscsi: check message ring page count at initialisation
335584
335584
A guest could set the message ring page count to zero, resulting in
335584
infinite loop. Add check to avoid it.
335584
335584
Reported-by: YY Z <bigbird475958471@gmail.com>
335584
Signed-off-by: P J P <ppandit@redhat.com>
335584
Message-Id: <20170425130623.3649-1-ppandit@redhat.com>
335584
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
335584
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
335584
(cherry picked from commit f68826989cd4d1217797251339579c57b3c0934e)
335584
---
335584
 hw/scsi/vmw_pvscsi.c | 2 +-
335584
 1 file changed, 1 insertion(+), 1 deletion(-)
335584
335584
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
335584
index 75575461e2..4a106da856 100644
335584
--- a/hw/scsi/vmw_pvscsi.c
335584
+++ b/hw/scsi/vmw_pvscsi.c
335584
@@ -202,7 +202,7 @@ pvscsi_ring_init_msg(PVSCSIRingInfo *m, PVSCSICmdDescSetupMsgRing *ri)
335584
     uint32_t len_log2;
335584
     uint32_t ring_size;
335584
 
335584
-    if (ri->numPages > PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES) {
335584
+    if (!ri->numPages || ri->numPages > PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES) {
335584
         return -1;
335584
     }
335584
     ring_size = ri->numPages * PVSCSI_MAX_NUM_MSG_ENTRIES_PER_PAGE;