aboutsummaryrefslogtreecommitdiff
path: root/mm/mempolicy.c
diff options
context:
space:
mode:
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>2013-09-11 14:22:16 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 15:57:50 -0700
commit0bf598d863e3c741d47e3178d645f04c9d6c186c (patch)
tree4929a438298150fa92c800ac40c337d36531a70e /mm/mempolicy.c
parent98094945785464c657d598291d714d11694c8cd9 (diff)
mbind: add BUG_ON(!vma) in new_vma_page()
new_vma_page() is called only by page migration called from do_mbind(), where pages to be migrated are queued into a pagelist by queue_pages_range(). queue_pages_range() confirms that a queued page belongs to some vma, so !vma case is not supposed to be happen. This patch adds BUG_ON() to catch this unexpected case. Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r--mm/mempolicy.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 9d778637b08..04729647f35 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1196,12 +1196,14 @@ static struct page *new_vma_page(struct page *page, unsigned long private, int *
break;
vma = vma->vm_next;
}
+ /*
+ * queue_pages_range() confirms that @page belongs to some vma,
+ * so vma shouldn't be NULL.
+ */
+ BUG_ON(!vma);
if (PageHuge(page))
return alloc_huge_page_noerr(vma, address, 1);
- /*
- * if !vma, alloc_page_vma() will use task or system default policy
- */
return alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
}
#else