From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjhi9-0007Z8-Io for qemu-devel@nongnu.org; Tue, 13 Sep 2016 03:00:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjhi4-0001nN-Cg for qemu-devel@nongnu.org; Tue, 13 Sep 2016 03:00:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjhi4-0001nI-6l for qemu-devel@nongnu.org; Tue, 13 Sep 2016 03:00:48 -0400 Date: Tue, 13 Sep 2016 12:30:42 +0530 (IST) From: P J P In-Reply-To: <1473223408-24079-1-git-send-email-ppandit@redhat.com> Message-ID: References: <1473223408-24079-1-git-send-email-ppandit@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [Qemu-devel] [PATCH] scsi: pvscsi: limit process IO loop to maximum page count List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Qemu Developers Cc: Dmitry Fleytman , Paolo Bonzini , Li Qiang +-- On Wed, 7 Sep 2016, P J P wrote --+ | From: Prasad J Pandit | | Vmware Paravirtual SCSI emulator while processing IO requests | could run into an infinite loop if 'pvscsi_ring_pop_req_descr' | always returned positive value. Limit IO loop to the maximum | page count. | | Reported-by: Li Qiang | Signed-off-by: Prasad J Pandit | --- | hw/scsi/vmw_pvscsi.c | 4 +++- | 1 file changed, 3 insertions(+), 1 deletion(-) | | diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c | index babac5a..3e77a08 100644 | --- a/hw/scsi/vmw_pvscsi.c | +++ b/hw/scsi/vmw_pvscsi.c | @@ -711,11 +711,13 @@ pvscsi_process_request_descriptor(PVSCSIState *s, | static void | pvscsi_process_io(PVSCSIState *s) | { | + int descr_pa_cnt = 0; | PVSCSIRingReqDesc descr; | hwaddr next_descr_pa; | | assert(s->rings_info_valid); | - while ((next_descr_pa = pvscsi_ring_pop_req_descr(&s->rings)) != 0) { | + while (((next_descr_pa = pvscsi_ring_pop_req_descr(&s->rings)) != 0) | + && descr_pa_cnt++ < PVSCSI_SETUP_RINGS_MAX_NUM_PAGES) { | | /* Only read after production index verification */ | smp_rmb(); Ping...! -- Prasad J Pandit / Red Hat Product Security Team 47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F