diff --git a/[refs] b/[refs] index ddb471e07364..f407396d4f2f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c6ea21e35bf3691cad59647c771e6606067f627d +refs/heads/master: 4829b906cc063cb7cd1b7f34fa05de6db75ec8bb diff --git a/trunk/mm/rmap.c b/trunk/mm/rmap.c index 9d2ba01bd4f9..92e6757f196e 100644 --- a/trunk/mm/rmap.c +++ b/trunk/mm/rmap.c @@ -381,7 +381,13 @@ vma_address(struct page *page, struct vm_area_struct *vma) unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma) { if (PageAnon(page)) { - if (vma->anon_vma->root != page_anon_vma(page)->root) + struct anon_vma *page__anon_vma = page_anon_vma(page); + /* + * Note: swapoff's unuse_vma() is more efficient with this + * check, and needs it to match anon_vma when KSM is active. + */ + if (!vma->anon_vma || !page__anon_vma || + vma->anon_vma->root != page__anon_vma->root) return -EFAULT; } else if (page->mapping && !(vma->vm_flags & VM_NONLINEAR)) { if (!vma->vm_file ||