[PATCH 3.11 014/208] mm/hugetlb: check for pte NULL pointer in __page_check_address()

Luis Henriques luis.henriques at canonical.com
Mon Jan 13 15:57:35 UTC 2014


3.11.10.3 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jianguo Wu <wujianguo at huawei.com>

commit 98398c32f6687ee1e1f3ae084effb4b75adb0747 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 <wujianguo at huawei.com>
Cc: Naoya Horiguchi <n-horiguchi at ah.jp.nec.com>
Cc: Mel Gorman <mgorman at suse.de>
Cc: qiuxishi <qiuxishi at huawei.com>
Cc: Hanjun Guo <guohanjun at huawei.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov at linux.intel.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 mm/rmap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/rmap.c b/mm/rmap.c
index b2e29ac..75f4c82 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -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;
 	}
-- 
1.8.3.2





More information about the kernel-team mailing list