* [PATCH] mm/hugetlb: check for pte NULL pointer in __page_check_address()
@ 2013-12-16 9:33 ` Jianguo Wu
0 siblings, 0 replies; 6+ messages in thread
From: Jianguo Wu @ 2013-12-16 9:33 UTC (permalink / raw)
To: Andrew Morton
Cc: kirill.shutemov, Naoya Horiguchi, Mel Gorman, linux-mm,
linux-kernel, qiuxishi, Hanjun Guo
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>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] mm/hugetlb: check for pte NULL pointer in __page_check_address()
@ 2013-12-16 9:33 ` Jianguo Wu
0 siblings, 0 replies; 6+ messages in thread
From: Jianguo Wu @ 2013-12-16 9:33 UTC (permalink / raw)
To: Andrew Morton
Cc: kirill.shutemov, Naoya Horiguchi, Mel Gorman, linux-mm,
linux-kernel, qiuxishi, Hanjun Guo
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>
---
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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH] mm/hugetlb: check for pte NULL pointer in __page_check_address()
2013-12-16 9:33 ` Jianguo Wu
@ 2013-12-16 14:25 ` Kirill A. Shutemov
-1 siblings, 0 replies; 6+ messages in thread
From: Kirill A. Shutemov @ 2013-12-16 14:25 UTC (permalink / raw)
To: Jianguo Wu
Cc: Andrew Morton, kirill.shutemov, Naoya Horiguchi, Mel Gorman,
linux-mm, linux-kernel, qiuxishi, Hanjun Guo
Jianguo Wu wrote:
> 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>
Looks okay to me.
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Have you triggered a crash there? Or just spotted by reading the code?
--
Kirill A. Shutemov
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] mm/hugetlb: check for pte NULL pointer in __page_check_address()
@ 2013-12-16 14:25 ` Kirill A. Shutemov
0 siblings, 0 replies; 6+ messages in thread
From: Kirill A. Shutemov @ 2013-12-16 14:25 UTC (permalink / raw)
To: Jianguo Wu
Cc: Andrew Morton, kirill.shutemov, Naoya Horiguchi, Mel Gorman,
linux-mm, linux-kernel, qiuxishi, Hanjun Guo
Jianguo Wu wrote:
> 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>
Looks okay to me.
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Have you triggered a crash there? Or just spotted by reading the code?
--
Kirill A. Shutemov
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm/hugetlb: check for pte NULL pointer in __page_check_address()
2013-12-16 14:25 ` Kirill A. Shutemov
@ 2013-12-17 1:07 ` Jianguo Wu
-1 siblings, 0 replies; 6+ messages in thread
From: Jianguo Wu @ 2013-12-17 1:07 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Andrew Morton, Naoya Horiguchi, Mel Gorman, linux-mm,
linux-kernel, qiuxishi, Hanjun Guo
Hi Kirill,
On 2013/12/16 22:25, Kirill A. Shutemov wrote:
> Jianguo Wu wrote:
>> 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>
>
> Looks okay to me.
>
> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
>
> Have you triggered a crash there? Or just spotted by reading the code?
>
By reading the code.
Thanks,
Jianguo Wu
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm/hugetlb: check for pte NULL pointer in __page_check_address()
@ 2013-12-17 1:07 ` Jianguo Wu
0 siblings, 0 replies; 6+ messages in thread
From: Jianguo Wu @ 2013-12-17 1:07 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Andrew Morton, Naoya Horiguchi, Mel Gorman, linux-mm,
linux-kernel, qiuxishi, Hanjun Guo
Hi Kirill,
On 2013/12/16 22:25, Kirill A. Shutemov wrote:
> Jianguo Wu wrote:
>> 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>
>
> Looks okay to me.
>
> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
>
> Have you triggered a crash there? Or just spotted by reading the code?
>
By reading the code.
Thanks,
Jianguo Wu
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-12-17 1:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-16 9:33 [PATCH] mm/hugetlb: check for pte NULL pointer in __page_check_address() Jianguo Wu
2013-12-16 9:33 ` Jianguo Wu
2013-12-16 14:25 ` Kirill A. Shutemov
2013-12-16 14:25 ` Kirill A. Shutemov
2013-12-17 1:07 ` Jianguo Wu
2013-12-17 1:07 ` Jianguo Wu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.