diff options
author | P J P <ppandit@redhat.com> | 2017-04-25 18:36:23 +0530 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-05-05 12:09:59 +0200 |
commit | f68826989cd4d1217797251339579c57b3c0934e (patch) | |
tree | fd7c50c5998d0b9dcca13a8a6001192d05cb571d /hw | |
parent | c8c33fca88fc3ab8a5e4bb2e34d26a97e9ba8e5a (diff) | |
download | qemu-f68826989cd4d1217797251339579c57b3c0934e.zip qemu-f68826989cd4d1217797251339579c57b3c0934e.tar.gz qemu-f68826989cd4d1217797251339579c57b3c0934e.tar.bz2 |
vmw_pvscsi: check message ring page count at initialisation
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>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/scsi/vmw_pvscsi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c index 7557546..4a106da 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; |