mm/hugetlb: check for pte NULL pointer in __page_check_address()
Subsystems (2)
PATCH 1/1 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.
--- mm/rmap.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
mm/rmap.c +4 -0
@@ -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; }
Signature · 8 lines
1.7.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 4 lines · Jianguo Wu
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]>
Looks okay to me.
Have you triggered a crash there? Or just spotted by reading the code?
Signature · 1 line
Kirill A. Shutemov
Hi Kirill,
Quoted 4 lines · Kirill A. Shutemov
Quoted 3 lines · Jianguo Wu
In
__page_check_address(), if address's pud is not present,huge_pte_offset()will return NULL, we should check the return value.
Quoted 8 lines
Quoted 1 line
Signed-off-by Jianguo Wu <[email protected]>Looks okay to me.
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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>