qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH] iscsi: fix assertion in is_sector_request_lun_a


From: Eric Blake
Subject: Re: [Qemu-block] [PATCH] iscsi: fix assertion in is_sector_request_lun_aligned
Date: Mon, 20 Jun 2016 10:47:20 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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 allocation
>     status requests up to INT_MAX sectors which triggers the assertion.
> 
> Fixes: 94d047a35bf663e28f8fef137544d8ea78165add
> Signed-off-by: Peter Lieven <address@hidden>
> ---
>  block/iscsi.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 

Reviewed-by: Eric Blake <address@hidden>

> 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 offset, 
> int count,
>  static bool is_sector_request_lun_aligned(int64_t sector_num, int nb_sectors,
>                                            IscsiLun *iscsilun)
>  {
> -    assert(nb_sectors < BDRV_REQUEST_MAX_SECTORS);
> +    assert(nb_sectors <= 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(BlockDriverState 
> *bs,
>          int64_t ret;
>          int pnum;
>          BlockDriverState *file;
> -        ret = iscsi_co_get_block_status(bs, sector_num, INT_MAX, &pnum, 
> &file);
> +        ret = iscsi_co_get_block_status(bs, sector_num,
> +                                        BDRV_REQUEST_MAX_SECTORS, &pnum, 
> &file);
>          if (ret < 0) {
>              return ret;
>          }
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]