Re: [PATCH 03/20] mm: Use pgoff in struct vm_fault instead of passing it separately

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri 14-10-16 12:42:51, Ross Zwisler wrote:
> On Tue, Sep 27, 2016 at 06:08:07PM +0200, Jan Kara wrote:
> > struct vm_fault has already pgoff entry. Use it instead of passing pgoff
> > as a separate argument and then assigning it later.
> > 
> > Signed-off-by: Jan Kara <jack@xxxxxxx>
> > ---
> >  mm/memory.c | 35 ++++++++++++++++++-----------------
> >  1 file changed, 18 insertions(+), 17 deletions(-)
> > 
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 447a1ef4a9e3..4c2ec9a9d8af 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -2275,7 +2275,7 @@ static int wp_pfn_shared(struct vm_fault *vmf, pte_t orig_pte)
> >  	if (vma->vm_ops && vma->vm_ops->pfn_mkwrite) {
> >  		struct vm_fault vmf2 = {
> >  			.page = NULL,
> > -			.pgoff = linear_page_index(vma, vmf->address),
> > +			.pgoff = vmf->pgoff,
> 
> I think there is one path where vmf->pgoff isn't set here.  Here's the path:
> 
> __collapse_huge_page_swapin()
>   do_swap_page()
>     do_wp_page()
>       wp_pfn_shared()
> 
> We then use an uninitialized vmf->pgoff to set up vmf2->pgoff, which we pass
> to vm_ops->pfn_mkwrite().
> 
> I think all we need to do to fix this is initialize .pgoff in
> __collapse_huge_page_swapin().  With this one change:
> 
> Reviewed-by: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>

Thanks for catching this. I don't think that bug had any visible effect
since for anonymous pages (which is what do_swap_page() handles) we won't
enter wp_pfn_shared() but it is definitely good to fix this.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]