* [PATCH V2] block: pass inclusive 'lend' parameter to truncate_inode_pages_range
@ 2018-02-10 0:46 Ming Lei
2018-02-22 3:23 ` Ming Lei
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ming Lei @ 2018-02-10 0:46 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig
Cc: linux-block, Ming Lei, stable, Dmitry Monakhov
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: <stable@vger.kernel.org>
Cc: Dmitry Monakhov <dmonakhov@openvz.org>
Fixes: 351499a172c0 ("block: Invalidate cache on discard v2")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V2] block: pass inclusive 'lend' parameter to truncate_inode_pages_range
2018-02-10 0:46 [PATCH V2] block: pass inclusive 'lend' parameter to truncate_inode_pages_range Ming Lei
@ 2018-02-22 3:23 ` Ming Lei
2018-02-23 20:47 ` Bart Van Assche
2018-02-23 22:20 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Ming Lei @ 2018-02-22 3:23 UTC (permalink / raw)
To: Ming Lei
Cc: Jens Axboe, Christoph Hellwig, linux-block, stable,
Dmitry Monakhov
On Sat, Feb 10, 2018 at 8:46 AM, Ming Lei <ming.lei@redhat.com> 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: <stable@vger.kernel.org>
> Cc: Dmitry Monakhov <dmonakhov@openvz.org>
> Fixes: 351499a172c0 ("block: Invalidate cache on discard v2")
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] block: pass inclusive 'lend' parameter to truncate_inode_pages_range
2018-02-10 0:46 [PATCH V2] block: pass inclusive 'lend' parameter to truncate_inode_pages_range Ming Lei
2018-02-22 3:23 ` Ming Lei
@ 2018-02-23 20:47 ` Bart Van Assche
2018-02-23 22:20 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2018-02-23 20:47 UTC (permalink / raw)
To: hch@infradead.org, ming.lei@redhat.com, axboe@kernel.dk
Cc: dmonakhov@openvz.org, linux-block@vger.kernel.org,
stable@vger.kernel.org
T24gU2F0LCAyMDE4LTAyLTEwIGF0IDA4OjQ2ICswODAwLCBNaW5nIExlaSB3cm90ZToNCj4gVGhl
ICdsZW5kJyBwYXJhbWV0ZXIgb2YgdHJ1bmNhdGVfaW5vZGVfcGFnZXNfcmFuZ2UgaXMgcmVxdWly
ZWQgdG8gYmUNCj4gaW5jbHVzaXZlLCBzbyBmb2xsb3cgdGhlIHJ1bGUuDQo+IA0KPiBUaGlzIHBh
dGNoIGZpeGVzIG9uZSBtZW1vcnkgY29ycnVwdGlvbiB0cmlnZ2VyZWQgYnkgZGlzY2FyZC4NCg0K
UmV2aWV3ZWQtYnk6IEJhcnQgVmFuIEFzc2NoZSA8YmFydC52YW5hc3NjaGVAd2RjLmNvbT4NCg0K
DQoNCg==
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] block: pass inclusive 'lend' parameter to truncate_inode_pages_range
2018-02-10 0:46 [PATCH V2] block: pass inclusive 'lend' parameter to truncate_inode_pages_range Ming Lei
2018-02-22 3:23 ` Ming Lei
2018-02-23 20:47 ` Bart Van Assche
@ 2018-02-23 22:20 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2018-02-23 22:20 UTC (permalink / raw)
To: Ming Lei, Christoph Hellwig; +Cc: linux-block, stable, Dmitry Monakhov
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-23 22:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-10 0:46 [PATCH V2] block: pass inclusive 'lend' parameter to truncate_inode_pages_range Ming Lei
2018-02-22 3:23 ` Ming Lei
2018-02-23 20:47 ` Bart Van Assche
2018-02-23 22:20 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).