block: pass inclusive 'lend' parameter to truncate_inode_pages_range

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: <[email protected]>
Cc: Dmitry Monakhov <[email protected]>
Fixes: 351499a172 ("block: Invalidate cache on discard v2")
Reviewed-by: Bart Van Assche <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
Ming Lei authored and Jens Axboe committed 2018-02-23 15:20:19 -07:00
1 parent 0f9da844d8
commit 0bd1ed4860
1 file changed
+1 -1
+1 -1
View File
@@ -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);
}