[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <52AEC8FD.6050200@huawei.com>
Date: Mon, 16 Dec 2013 17:33:49 +0800
From: Jianguo Wu <wujianguo@...wei.com>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: <kirill.shutemov@...ux.intel.com>,
Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
Mel Gorman <mgorman@...e.de>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, qiuxishi <qiuxishi@...wei.com>,
Hanjun Guo <guohanjun@...wei.com>
Subject: [PATCH] mm/hugetlb: check for pte NULL pointer in __page_check_address()
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@...wei.com>
---
mm/rmap.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/mm/rmap.c b/mm/rmap.c
index 55c8b8d..068522d 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 = huge_pte_lockptr(page_hstate(page), mm, pte);
goto check;
}
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists