* [PATCH] fs: Do to trim high file position bits in iomap_page_mkwrite_actor
@ 2016-10-20 11:35 Jan Kara
2016-10-21 12:06 ` Christoph Hellwig
2016-10-24 3:23 ` Dave Chinner
0 siblings, 2 replies; 3+ messages in thread
From: Jan Kara @ 2016-10-20 11:35 UTC (permalink / raw)
To: Dave Chinner; +Cc: Christoph Hellwig, linux-fsdevel, Jan Kara
iomap_page_mkwrite_actor() calls __block_write_begin_int() with position
masked as pos & ~PAGE_MASK which is equivalent to pos & (PAGE_SIZE-1).
Thus it masks off high bits of file position. However
__block_write_begin_int() expects full file position on input. This does
not cause any visible issues because all __block_write_begin_int()
really cares about are low file position bits but still it is a bug
waiting to happen.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/iomap.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/iomap.c b/fs/iomap.c
index 013d1d36fbbf..3341907eefc7 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -433,8 +433,7 @@ iomap_page_mkwrite_actor(struct inode *inode, loff_t pos, loff_t length,
struct page *page = data;
int ret;
- ret = __block_write_begin_int(page, pos & ~PAGE_MASK, length,
- NULL, iomap);
+ ret = __block_write_begin_int(page, pos, length, NULL, iomap);
if (ret)
return ret;
--
2.6.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: Do to trim high file position bits in iomap_page_mkwrite_actor
2016-10-20 11:35 [PATCH] fs: Do to trim high file position bits in iomap_page_mkwrite_actor Jan Kara
@ 2016-10-21 12:06 ` Christoph Hellwig
2016-10-24 3:23 ` Dave Chinner
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2016-10-21 12:06 UTC (permalink / raw)
To: Jan Kara; +Cc: Dave Chinner, Christoph Hellwig, linux-fsdevel
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: Do to trim high file position bits in iomap_page_mkwrite_actor
2016-10-20 11:35 [PATCH] fs: Do to trim high file position bits in iomap_page_mkwrite_actor Jan Kara
2016-10-21 12:06 ` Christoph Hellwig
@ 2016-10-24 3:23 ` Dave Chinner
1 sibling, 0 replies; 3+ messages in thread
From: Dave Chinner @ 2016-10-24 3:23 UTC (permalink / raw)
To: Jan Kara; +Cc: Christoph Hellwig, linux-fsdevel
On Thu, Oct 20, 2016 at 01:35:42PM +0200, Jan Kara wrote:
> iomap_page_mkwrite_actor() calls __block_write_begin_int() with position
> masked as pos & ~PAGE_MASK which is equivalent to pos & (PAGE_SIZE-1).
> Thus it masks off high bits of file position. However
> __block_write_begin_int() expects full file position on input. This does
> not cause any visible issues because all __block_write_begin_int()
> really cares about are low file position bits but still it is a bug
> waiting to happen.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> fs/iomap.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/iomap.c b/fs/iomap.c
> index 013d1d36fbbf..3341907eefc7 100644
> --- a/fs/iomap.c
> +++ b/fs/iomap.c
> @@ -433,8 +433,7 @@ iomap_page_mkwrite_actor(struct inode *inode, loff_t pos, loff_t length,
> struct page *page = data;
> int ret;
>
> - ret = __block_write_begin_int(page, pos & ~PAGE_MASK, length,
> - NULL, iomap);
> + ret = __block_write_begin_int(page, pos, length, NULL, iomap);
> if (ret)
> return ret;
Looks good. I've added it to my -rc3 fixes series.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-24 3:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-20 11:35 [PATCH] fs: Do to trim high file position bits in iomap_page_mkwrite_actor Jan Kara
2016-10-21 12:06 ` Christoph Hellwig
2016-10-24 3:23 ` Dave Chinner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.