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
commit 98398c3 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: Jianguo Wu <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: qiuxishi <[email protected]>
Cc: Hanjun Guo <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Jianguo Wu authored and gregkh committed Jan 9, 2014
1 parent 31eb5f2 commit 398bbc5
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 = &mm->page_table_lock;
goto check;
}
Expand Down

0 comments on commit 398bbc5

Please sign in to comment.