]> Git Repo - qemu.git/commitdiff
vmw_pvscsi: check message ring page count at initialisation
authorP J P <[email protected]>
Tue, 25 Apr 2017 13:06:23 +0000 (18:36 +0530)
committerPaolo Bonzini <[email protected]>
Fri, 5 May 2017 10:09:59 +0000 (12:09 +0200)
A guest could set the message ring page count to zero, resulting in
infinite loop. Add check to avoid it.

Reported-by: YY Z <[email protected]>
Signed-off-by: P J P <[email protected]>
Message-Id: <20170425130623[email protected]>
Reviewed-by: Dmitry Fleytman <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
hw/scsi/vmw_pvscsi.c

index 75575461e2563b63ad272b52978c1547c61b7f80..4a106da8564656991d98eb16cc07c9b69730fe93 100644 (file)
@@ -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;
This page took 0.022952 seconds and 4 git commands to generate.