diff options
author | Michal Hocko <mhocko@suse.cz> | 2014-01-10 12:41:30 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2014-01-10 12:41:30 +1100 |
commit | 51339ee00c3d0fc2ebfc10072efb933217aed6f1 (patch) | |
tree | 295bb04263226e0efa708ac44443cbaa7e2fceb9 /mm | |
parent | 157bbe1dab20f8c75917be538d70dbf747e5ea3a (diff) |
mm: new_vma_page() cannot see NULL vma for hugetlb pages
11c731e81bb0 ("mm/mempolicy: fix !vma in new_vma_page()") has removed
BUG_ON(!vma) from new_vma_page which is partially correct because
page_address_in_vma will return EFAULT for non-linear mappings and at
least shared shmem might be mapped this way.
The patch also tried to prevent NULL ptr for hugetlb pages which is not
correct AFAICS because hugetlb pages cannot be mapped as VM_NONLINEAR and
other conditions in page_address_in_vma seem to be legit and catch real
bugs.
This patch restores BUG_ON for PageHuge to catch potential issues when the
to-be-migrated page is not setup properly.
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Reviewed-by: Bob Liu <bob.liu@oracle.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mempolicy.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 947293e76533..463b7fbf0d1d 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1199,10 +1199,8 @@ static struct page *new_vma_page(struct page *page, unsigned long private, int * } if (PageHuge(page)) { - if (vma) - return alloc_huge_page_noerr(vma, address, 1); - else - return NULL; + BUG_ON(!vma); + return alloc_huge_page_noerr(vma, address, 1); } /* * if !vma, alloc_page_vma() will use task or system default policy |