Commit 2efb73fb authored by Jianguo Wu's avatar Jianguo Wu Committed by Greg Kroah-Hartman

mm/hugetlb: check for pte NULL pointer in __page_check_address()

commit 98398c32 upstream.

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: default avatarJianguo 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: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1005954e
...@@ -623,7 +623,11 @@ pte_t *__page_check_address(struct page *page, struct mm_struct *mm, ...@@ -623,7 +623,11 @@ pte_t *__page_check_address(struct page *page, struct mm_struct *mm,
spinlock_t *ptl; spinlock_t *ptl;
if (unlikely(PageHuge(page))) { if (unlikely(PageHuge(page))) {
/* when pud is not present, pte will be NULL */
pte = huge_pte_offset(mm, address); pte = huge_pte_offset(mm, address);
if (!pte)
return NULL;
ptl = &mm->page_table_lock; ptl = &mm->page_table_lock;
goto check; goto check;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment