All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@infradead.org>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs: Do to trim high file position bits in iomap_page_mkwrite_actor
Date: Mon, 24 Oct 2016 14:23:41 +1100	[thread overview]
Message-ID: <20161024032341.GW23194@dastard> (raw)
In-Reply-To: <1476963342-26989-1-git-send-email-jack@suse.cz>

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

      parent reply	other threads:[~2016-10-24  3:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161024032341.GW23194@dastard \
    --to=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.