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 <j...@suse.cz>
> > ---
> >  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.zwis...@linux.intel.com>

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 <j...@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to