ceph-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: David Howells <dhowells@redhat.com>,
	Matthew Wilcox <willy@infradead.org>
Cc: linux-fsdevel@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org,
	ceph-devel@vger.kernel.org,
	Marc Dionne <marc.dionne@auristor.com>,
	Mike Marshall <hubcap@omnibond.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-cachefs@redhat.com, Christoph Hellwig <hch@lst.de>,
	v9fs-developer@lists.sourceforge.net, linux-mm@kvack.org,
	linux-afs@lists.infradead.org,
	Dave Wysochanski <dwysocha@redhat.com>,
	Trond Myklebust <trond.myklebust@hammerspace.com>,
	Anna Schumaker <anna.schumaker@netapp.com>,
	Steve French <sfrench@samba.org>,
	Dominique Martinet <asmadeus@codewreck.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] netfs: Miscellaneous fixes
Date: Mon, 26 Apr 2021 18:17:26 -0400	[thread overview]
Message-ID: <728b55601fa54449cd43a35195641c00fbe6c096.camel@kernel.org> (raw)
In-Reply-To: <3737237.1619472003@warthog.procyon.org.uk>

On Mon, 2021-04-26 at 22:20 +0100, David Howells wrote:
> Okay, how about the attached, then?
> 
> David
> ---
> netfs: Miscellaneous fixes
>     
> 
> 
> 
> Fix some miscellaneous things in the new netfs lib[1]:
> 
>  (1) The kerneldoc for netfs_readpage() shouldn't say netfs_page().
> 
>  (2) netfs_readpage() can get an integer overflow on 32-bit when it
>      multiplies page_index(page) by PAGE_SIZE.  It should use
>      page_file_offset() instead.
> 
>  (3) netfs_write_begin() should use page_offset() to avoid the same
>      overflow.
> 
> Note that netfs_readpage() needs to use page_file_offset() rather than
> page_offset() as it may see swap-over-NFS.
> 
> Reported-by: Matthew Wilcox <willy@infradead.org>
> Signed-off-by: David Howells <dhowells@redhat.com>
> Link: https://lore.kernel.org/r/161789062190.6155.12711584466338493050.stgit@warthog.procyon.org.uk/ [1]
> ---
>  fs/netfs/read_helper.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c
> index 1d3b50c5db6d..193841d03de0 100644
> --- a/fs/netfs/read_helper.c
> +++ b/fs/netfs/read_helper.c
> @@ -933,7 +933,7 @@ void netfs_readahead(struct readahead_control *ractl,
>  EXPORT_SYMBOL(netfs_readahead);
>  
> 
> 
> 
>  /**
> - * netfs_page - Helper to manage a readpage request
> + * netfs_readpage - Helper to manage a readpage request
>   * @file: The file to read from
>   * @page: The page to read
>   * @ops: The network filesystem's operations for the helper to use
> @@ -968,7 +968,7 @@ int netfs_readpage(struct file *file,
>  		return -ENOMEM;
>  	}
>  	rreq->mapping	= page_file_mapping(page);
> -	rreq->start	= page_index(page) * PAGE_SIZE;
> +	rreq->start	= page_file_offset(page);
>  	rreq->len	= thp_size(page);
>  
> 
> 
> 
>  	if (ops->begin_cache_operation) {
> @@ -1106,7 +1106,7 @@ int netfs_write_begin(struct file *file, struct address_space *mapping,
>  	if (!rreq)
>  		goto error;
>  	rreq->mapping		= page->mapping;
> -	rreq->start		= page->index * PAGE_SIZE;
> +	rreq->start		= page_offset(page);
>  	rreq->len		= thp_size(page);
>  	rreq->no_unlock_page	= page->index;
>  	__set_bit(NETFS_RREQ_NO_UNLOCK_PAGE, &rreq->flags);
> 

Reviewed-by: Jeff Layton <jlayton@kernel.org>


      parent reply	other threads:[~2021-04-26 22:17 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 13:27 [PATCH v7 00/31] Network fs helper library & fscache kiocb API David Howells
2021-04-23 13:28 ` [PATCH v7 01/31] iov_iter: Add ITER_XARRAY David Howells
2021-04-23 14:06   ` Matthew Wilcox
2021-04-23 14:33   ` David Howells
2021-04-25 13:14   ` Al Viro
2021-04-25 13:58   ` David Howells
2021-04-25 14:16     ` Al Viro
2021-04-26 18:54   ` Al Viro
2021-04-26 19:15     ` Jeff Layton
2021-04-26 19:23   ` David Howells
2021-04-26 19:52     ` Al Viro
2021-04-23 13:28 ` [PATCH v7 02/31] mm: Add set/end/wait functions for PG_private_2 David Howells
2021-04-23 13:28 ` [PATCH v7 03/31] mm/filemap: Pass the file_ra_state in the ractl David Howells
2021-04-23 13:28 ` [PATCH v7 04/31] fs: Document file_ra_state David Howells
2021-04-23 13:28 ` [PATCH v7 05/31] mm/readahead: Handle ractl nr_pages being modified David Howells
2021-04-23 13:29 ` [PATCH v7 06/31] mm: Implement readahead_control pageset expansion David Howells
2021-04-23 13:29 ` [PATCH v7 07/31] netfs: Make a netfs helper module David Howells
2021-04-29  8:04   ` Geert Uytterhoeven
2021-04-29  8:41   ` David Howells
2021-04-29  8:43     ` Dominique Martinet
2021-04-23 13:29 ` [PATCH v7 08/31] netfs: Documentation for helper library David Howells
2021-04-23 13:29 ` [PATCH v7 09/31] netfs, mm: Move PG_fscache helper funcs to linux/netfs.h David Howells
2021-04-23 13:29 ` [PATCH v7 10/31] netfs, mm: Add set/end/wait_on_page_fscache() aliases David Howells
2021-04-23 13:30 ` [PATCH v7 11/31] netfs: Provide readahead and readpage netfs helpers David Howells
2021-04-23 13:30 ` [PATCH v7 12/31] netfs: Add tracepoints David Howells
2021-04-23 13:30 ` [PATCH v7 13/31] netfs: Gather stats David Howells
2021-04-23 13:30 ` [PATCH v7 14/31] netfs: Add write_begin helper David Howells
2021-04-23 13:31 ` [PATCH v7 15/31] netfs: Define an interface to talk to a cache David Howells
2021-04-23 13:31 ` [PATCH v7 16/31] netfs: Add a tracepoint to log failures that would be otherwise unseen David Howells
2021-04-23 13:31 ` [PATCH v7 17/31] fscache, cachefiles: Add alternate API to use kiocb for read/write to cache David Howells
2021-04-23 13:32 ` [PATCH v7 18/31] afs: Disable use of the fscache I/O routines David Howells
2021-04-23 13:32 ` [PATCH v7 19/31] afs: Pass page into dirty region helpers to provide THP size David Howells
2021-04-23 13:32 ` [PATCH v7 20/31] afs: Print the operation debug_id when logging an unexpected data version David Howells
2021-04-23 13:32 ` [PATCH v7 21/31] afs: Move key to afs_read struct David Howells
2021-04-23 13:33 ` [PATCH v7 22/31] afs: Don't truncate iter during data fetch David Howells
2021-04-23 13:33 ` [PATCH v7 23/31] afs: Log remote unmarshalling errors David Howells
2021-04-23 13:33 ` [PATCH v7 24/31] afs: Set up the iov_iter before calling afs_extract_data() David Howells
2021-04-23 13:33 ` [PATCH v7 25/31] afs: Use ITER_XARRAY for writing David Howells
2021-04-23 13:33 ` [PATCH v7 26/31] afs: Wait on PG_fscache before modifying/releasing a page David Howells
2021-04-23 13:34 ` [PATCH v7 27/31] afs: Extract writeback extension into its own function David Howells
2021-04-23 13:34 ` [PATCH v7 28/31] afs: Prepare for use of THPs David Howells
2021-04-23 13:34 ` [PATCH v7 29/31] afs: Use the fs operation ops to handle FetchData completion David Howells
2021-04-23 13:34 ` [PATCH v7 30/31] afs: Use new netfs lib read helper API David Howells
2021-04-23 13:34 ` [PATCH v7 31/31] afs: Use the netfs_write_begin() helper David Howells
2021-04-25 23:14 ` [PATCH] iov_iter: Four fixes for ITER_XARRAY David Howells
2021-04-26 17:14   ` Al Viro
2021-04-26 19:02   ` Jeff Layton
2021-04-26 21:38   ` David Wysochanski
2021-04-26 21:06 ` [PATCH] netfs: Miscellaneous fixes David Howells
2021-04-26 21:09   ` Matthew Wilcox
2021-04-26 21:20   ` [PATCH v2] " David Howells
2021-04-26 22:06     ` Matthew Wilcox
2021-04-26 22:17     ` Jeff Layton [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=728b55601fa54449cd43a35195641c00fbe6c096.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=anna.schumaker@netapp.com \
    --cc=asmadeus@codewreck.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=dwysocha@redhat.com \
    --cc=hch@lst.de \
    --cc=hubcap@omnibond.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=sfrench@samba.org \
    --cc=torvalds@linux-foundation.org \
    --cc=trond.myklebust@hammerspace.com \
    --cc=v9fs-developer@lists.sourceforge.net \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --subject='Re: [PATCH v2] netfs: Miscellaneous fixes' \
    /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

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox