qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] bogus bdrv_check_request in bdrv_co_discard


From: Kevin Wolf
Subject: Re: [Qemu-block] bogus bdrv_check_request in bdrv_co_discard
Date: Wed, 9 Mar 2016 15:58:37 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Am 09.03.2016 um 15:45 hat Olaf Hering geschrieben:
> On Wed, Mar 09, Paolo Bonzini wrote:
> 
> > It probably should range check max_unmap_size and max_io_size against
> > BDRV_REQUEST_MAX_SECTORS, and reject anything bigger than that, though.
> 
> Are you sure? Shouldnt the only check be if sect+num is inside the disk
> size? And everything smaller should be automatically split by qemu to
> whatever num.
> 
> I will see what works for me, probably something like this is already enough
> (for 2.0.2):
> 
> --- xen-4.5.2-testing.orig/tools/qemu-xen-dir-remote/block.c
> +++ xen-4.5.2-testing/tools/qemu-xen-dir-remote/block.c
> @@ -4898,7 +4898,8 @@ int coroutine_fn bdrv_co_discard(BlockDr
>  
>      if (!bs->drv) {
>          return -ENOMEDIUM;
> -    } else if (bdrv_check_request(bs, sector_num, nb_sectors)) {
> +    } else if (bdrv_check_byte_request(bs, sector_num * BDRV_SECTOR_SIZE,
> +                                           nb_sectors * BDRV_SECTOR_SIZE)) {
>          return -EIO;

Removing integer overflow checks without removing the potentially
overflowing operation doesn't feel like a particularly good idea,
though.

Kevin



reply via email to

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