All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vmw_pvscsi: check message ring page count at initialisation
@ 2017-04-25 13:06 P J P
  2017-04-25 15:52 ` Dmitry Fleytman
  0 siblings, 1 reply; 4+ messages in thread
From: P J P @ 2017-04-25 13:06 UTC (permalink / raw)
  To: Qemu Developers; +Cc: Paolo Bonzini, YY Z, Dmitry Fleytman, P J P

Vmware Paravirtual SCSI emulation uses command descriptors to
process SCSI commands. These come with their message ring buffers.
A guest could set the message ring page count to an arbitrary value
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>
---
 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 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;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] vmw_pvscsi: check message ring page count at initialisation
  2017-04-25 13:06 [Qemu-devel] [PATCH] vmw_pvscsi: check message ring page count at initialisation P J P
@ 2017-04-25 15:52 ` Dmitry Fleytman
  2017-04-27  8:43   ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Fleytman @ 2017-04-25 15:52 UTC (permalink / raw)
  To: P J P; +Cc: Qemu Developers, Paolo Bonzini, YY Z


> On 25 Apr 2017, at 16:06 PM, P J P <ppandit@redhat.com> wrote:
> 
> Vmware Paravirtual SCSI emulation uses command descriptors to
> process SCSI commands. These come with their message ring buffers.
> A guest could set the message ring page count to an arbitrary value
> resulting in infinite loop. Add check to avoid it.

Hello P J P,

Except the commit message that does not exactly correspond to what this patch does,

Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>


Thanks for the patch,
Dmitry.

> 
> Reported-by: YY Z <bigbird475958471@gmail.com>
> Signed-off-by: P J P <ppandit@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 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;
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] vmw_pvscsi: check message ring page count at initialisation
  2017-04-25 15:52 ` Dmitry Fleytman
@ 2017-04-27  8:43   ` Paolo Bonzini
  2017-04-27  8:50     ` P J P
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2017-04-27  8:43 UTC (permalink / raw)
  To: Dmitry Fleytman, P J P; +Cc: Qemu Developers, YY Z



On 25/04/2017 17:52, Dmitry Fleytman wrote:
> Except the commit message that does not exactly correspond to what this
> patch does,
> 
> Reviewed-by: Dmitry Fleytman <dmitry@daynix.com <mailto:dmitry@daynix.com>>

Adjusted the commit message and queued.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] vmw_pvscsi: check message ring page count at initialisation
  2017-04-27  8:43   ` Paolo Bonzini
@ 2017-04-27  8:50     ` P J P
  0 siblings, 0 replies; 4+ messages in thread
From: P J P @ 2017-04-27  8:50 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Dmitry Fleytman, Qemu Developers, YY Z

+-- On Thu, 27 Apr 2017, Paolo Bonzini wrote --+
| On 25/04/2017 17:52, Dmitry Fleytman wrote:
| > Except the commit message that does not exactly correspond to what this
| > patch does,
| > Reviewed-by: Dmitry Fleytman <dmitry@daynix.com <mailto:dmitry@daynix.com>>
| 
| Adjusted the commit message and queued.

Thank you.
--
 - P J P
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-27  8:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25 13:06 [Qemu-devel] [PATCH] vmw_pvscsi: check message ring page count at initialisation P J P
2017-04-25 15:52 ` Dmitry Fleytman
2017-04-27  8:43   ` Paolo Bonzini
2017-04-27  8:50     ` P J P

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.