From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF2MG-0007J6-77 for qemu-devel@nongnu.org; Mon, 20 Jun 2016 12:47:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bF2ME-000063-3D for qemu-devel@nongnu.org; Mon, 20 Jun 2016 12:47:31 -0400 References: <1466414680-18383-1-git-send-email-pl@kamp.de> From: Eric Blake Message-ID: <57681E18.8050002@redhat.com> Date: Mon, 20 Jun 2016 10:47:20 -0600 MIME-Version: 1.0 In-Reply-To: <1466414680-18383-1-git-send-email-pl@kamp.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="K98lBqmsia8W3MVD53H6W3CRxm9Mx2OFV" Subject: Re: [Qemu-devel] [PATCH] iscsi: fix assertion in is_sector_request_lun_aligned List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, ronniesahlberg@gmail.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --K98lBqmsia8W3MVD53H6W3CRxm9Mx2OFV From: Eric Blake To: Peter Lieven , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, ronniesahlberg@gmail.com Message-ID: <57681E18.8050002@redhat.com> Subject: Re: [PATCH] iscsi: fix assertion in is_sector_request_lun_aligned References: <1466414680-18383-1-git-send-email-pl@kamp.de> In-Reply-To: <1466414680-18383-1-git-send-email-pl@kamp.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/20/2016 03:24 AM, Peter Lieven wrote: > Commit 94d047a added an assertion the the request alignment check. > This introduced 2 issues: > a) A off-by-one error since a request of BDRV_REQUEST_MAX_SECTORS > is actually allowed. > b) The bdrv_get_block_status call in the read path to check the alloca= tion > status requests up to INT_MAX sectors which triggers the assertion.= >=20 > Fixes: 94d047a35bf663e28f8fef137544d8ea78165add > Signed-off-by: Peter Lieven > --- > block/iscsi.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) >=20 Reviewed-by: Eric Blake > diff --git a/block/iscsi.c b/block/iscsi.c > index 7e78ade..9bb5ff6 100644 > --- a/block/iscsi.c > +++ b/block/iscsi.c > @@ -417,7 +417,7 @@ static bool is_byte_request_lun_aligned(int64_t off= set, int count, > static bool is_sector_request_lun_aligned(int64_t sector_num, int nb_s= ectors, > IscsiLun *iscsilun) > { > - assert(nb_sectors < BDRV_REQUEST_MAX_SECTORS); > + assert(nb_sectors <=3D BDRV_REQUEST_MAX_SECTORS); > return is_byte_request_lun_aligned(sector_num << BDRV_SECTOR_BITS,= > nb_sectors << BDRV_SECTOR_BITS,= > iscsilun); > @@ -661,7 +661,8 @@ static int coroutine_fn iscsi_co_readv(BlockDriverS= tate *bs, > int64_t ret; > int pnum; > BlockDriverState *file; > - ret =3D iscsi_co_get_block_status(bs, sector_num, INT_MAX, &pn= um, &file); > + ret =3D iscsi_co_get_block_status(bs, sector_num, > + BDRV_REQUEST_MAX_SECTORS, &pnu= m, &file); > if (ret < 0) { > return ret; > } >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --K98lBqmsia8W3MVD53H6W3CRxm9Mx2OFV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXaB4YAAoJEKeha0olJ0NqqDEIAIp72SRQ16AZhK+P+5fYlJQz hAJ7kPpynBFFOUqBrcgWz3rNxlU1NZBI0mtCULVfTaauGs/Q6YKJ+MPreR8DdLP2 2IUKo1eVStC+Zoy0G4hnzbkMR936LWUmFyzpySl69GsNhefy1Y4pwpmQlziJLM3/ PhBOLJtRmVO0JHz+cSkCPs/dwYUqdRDh96OxsX/pXSSXjUL+J0/dhjBTisGHhy8w YbhGSV8xvK7fp6kO3SXi+LN817Z0slijQ/SSkCFeZ6YUGlVM2cG5H8VdDKayTmwe FwLrxpNQgm6xCV8Rc6dV+gwtzhj7x5b5FgM0Clc2oFdm7I1oE+RZBy69JMLhl0U= =Fj9P -----END PGP SIGNATURE----- --K98lBqmsia8W3MVD53H6W3CRxm9Mx2OFV--