Skip to content

Commit

Permalink
mm/hugetlb: check for pte NULL pointer in __page_check_address()
Browse files Browse the repository at this point in the history
In __page_check_address(), if address's pud is not present,
huge_pte_offset() will return NULL, we should check the return value.

Signed-off-by: Jianguo Wu <wujianguo@huawei.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: qiuxishi <qiuxishi@huawei.com>
Cc: Hanjun Guo <guohanjun@huawei.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jianguo Wu authored and Linus Torvalds committed Dec 19, 2013
1 parent 7ac1815 commit 98398c3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mm/rmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,11 @@ pte_t *__page_check_address(struct page *page, struct mm_struct *mm,
spinlock_t *ptl;

if (unlikely(PageHuge(page))) {
/* when pud is not present, pte will be NULL */
pte = huge_pte_offset(mm, address);
if (!pte)
return NULL;

ptl = huge_pte_lockptr(page_hstate(page), mm, pte);
goto check;
}
Expand Down

0 comments on commit 98398c3

Please sign in to comment.