summaryrefslogtreecommitdiff
path: root/mm/pagewalk.c
diff options
context:
space:
mode:
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>2014-05-22 10:42:43 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2014-05-22 10:42:43 +1000
commit9e9df4dda900317c0a431d096d1dface033ebbd9 (patch)
tree46dd60e1feeeaac7347a3be1834ef1dedcf09230 /mm/pagewalk.c
parent3863b7ea2d73aff25266cc19ef971fdb668a4ce5 (diff)
mm/pagewalk.c: move pte null check
huge_pte_offset() can return NULL, so we need check it before trying to take page table lock to avoid a crash. Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Reported-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/pagewalk.c')
-rw-r--r--mm/pagewalk.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/pagewalk.c b/mm/pagewalk.c
index a834f4deb52..b2a075ffb96 100644
--- a/mm/pagewalk.c
+++ b/mm/pagewalk.c
@@ -193,12 +193,14 @@ static int walk_hugetlb_range(unsigned long addr, unsigned long end,
do {
next = hugetlb_entry_end(h, addr, end);
pte = huge_pte_offset(walk->mm, addr & hmask);
+ if (!pte)
+ continue;
ptl = huge_pte_lock(h, mm, pte);
/*
* Callers should have their own way to handle swap entries
* in walk->hugetlb_entry().
*/
- if (pte && walk->hugetlb_entry)
+ if (walk->hugetlb_entry)
err = walk->hugetlb_entry(pte, addr, next, walk);
spin_unlock(ptl);
if (err)