Received: from eggs.gnu.org ([2001:4830:134:3::10]:50129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjnTA-0001s6-Mj for qemu-devel@nongnu.org; Tue, 13 Sep 2016 09:09:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjnT5-00072s-Lz for qemu-devel@nongnu.org; Tue, 13 Sep 2016 09:09:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjnT5-00072m-HG for qemu-devel@nongnu.org; Tue, 13 Sep 2016 09:09:43 -0400 Date: Tue, 13 Sep 2016 18:39:38 +0530 (IST) From: P J P In-Reply-To: <60DE88ED-33CA-4050-9CB1-905930AC1A06@daynix.com> Message-ID: References: <1473223408-24079-1-git-send-email-ppandit@redhat.com> <36CEB473-4A85-4C0E-AF37-668D3F21B373@daynix.com> <60DE88ED-33CA-4050-9CB1-905930AC1A06@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Dmitry Fleytman Cc: Qemu Developers , Paolo Bonzini , Li Qiang +-- On Tue, 13 Sep 2016, Dmitry Fleytman wrote --+ | > A guest user could set the 'ready_ptr' and 'PVSCSIRingInfo *mgr' par= ameter=20 | > in 'pvscsi_ring_pop_req_descr', such that it always returns true. |=20 | I see. The problematic code is if (ready_ptr !=3D mgr->consumed_ptr) {=E2= =80=A6} |=20 | mgr->consumed_ptr is managed by device and not visible to the driver, | but ready_ptr is managed by driver and may be set to some =E2=80=9Cbig=E2= =80=9D number. |=20 | In this case it may take a lot of iterations for consumed_ptr | to become equal to ready_ptr and additionally some requests will be sen= d multiple times. |=20 | The most straightforward way to fix this issue will be to | check that ready_ptr - consumed_ptr is less than ring size. I see. | I think you=E2=80=99re mixing concepts of number of | pages in the ring and number of requests in the ring. |=20 | Each page contains (much) more than one request. I see, okay. Thank you so much for the details. I'll send a revised patch. Thank you. -- Prasad J Pandit / Red Hat Product Security Team 47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F