Re: [PATCH V2] block: pass inclusive 'lend' parameter to truncate_inode_pages_range

2018-02-23 Thread Jens Axboe
On 2/9/18 5:46 PM, Ming Lei wrote:
> The 'lend' parameter of truncate_inode_pages_range is required to be
> inclusive, so follow the rule.
> 
> This patch fixes one memory corruption triggered by discard.

Applied, thanks.

-- 
Jens Axboe



Re: [PATCH V2] block: pass inclusive 'lend' parameter to truncate_inode_pages_range

2018-02-23 Thread Bart Van Assche
On Sat, 2018-02-10 at 08:46 +0800, Ming Lei wrote:
> The 'lend' parameter of truncate_inode_pages_range is required to be
> inclusive, so follow the rule.
> 
> This patch fixes one memory corruption triggered by discard.

Reviewed-by: Bart Van Assche 





Re: [PATCH V2] block: pass inclusive 'lend' parameter to truncate_inode_pages_range

2018-02-21 Thread Ming Lei
On Sat, Feb 10, 2018 at 8:46 AM, Ming Lei  wrote:
> The 'lend' parameter of truncate_inode_pages_range is required to be
> inclusive, so follow the rule.
>
> This patch fixes one memory corruption triggered by discard.
>
> Cc: 
> Cc: Dmitry Monakhov 
> Fixes: 351499a172c0 ("block: Invalidate cache on discard v2")
> Signed-off-by: Ming Lei 
> ---
> V2:
> - Cc stable list and Dmitry as suggested by Bart
>
>  block/ioctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/ioctl.c b/block/ioctl.c
> index 1668506d8ed8..3884d810efd2 100644
> --- a/block/ioctl.c
> +++ b/block/ioctl.c
> @@ -225,7 +225,7 @@ static int blk_ioctl_discard(struct block_device *bdev, 
> fmode_t mode,
>
> if (start + len > i_size_read(bdev->bd_inode))
> return -EINVAL;
> -   truncate_inode_pages_range(mapping, start, start + len);
> +   truncate_inode_pages_range(mapping, start, start + len - 1);
> return blkdev_issue_discard(bdev, start >> 9, len >> 9,
> GFP_KERNEL, flags);
>  }
> --
> 2.9.5
>

Hi Jens,

Could you consider it in v4.16 since it does fix a regression in lkp test?

Thanks,
Ming Lei


[PATCH V2] block: pass inclusive 'lend' parameter to truncate_inode_pages_range

2018-02-09 Thread Ming Lei
The 'lend' parameter of truncate_inode_pages_range is required to be
inclusive, so follow the rule.

This patch fixes one memory corruption triggered by discard.

Cc: 
Cc: Dmitry Monakhov 
Fixes: 351499a172c0 ("block: Invalidate cache on discard v2")
Signed-off-by: Ming Lei 
---
V2:
- Cc stable list and Dmitry as suggested by Bart

 block/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/ioctl.c b/block/ioctl.c
index 1668506d8ed8..3884d810efd2 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -225,7 +225,7 @@ static int blk_ioctl_discard(struct block_device *bdev, 
fmode_t mode,
 
if (start + len > i_size_read(bdev->bd_inode))
return -EINVAL;
-   truncate_inode_pages_range(mapping, start, start + len);
+   truncate_inode_pages_range(mapping, start, start + len - 1);
return blkdev_issue_discard(bdev, start >> 9, len >> 9,
GFP_KERNEL, flags);
 }
-- 
2.9.5