pti_user_pagetable_walk_pmd() may return NULL, we should check the return value in pti_user_pagetable_walk_pte() to avoid NULL pointer dereference like it is checked in pti_clone_pmds().
Signed-off-by: Jiang Biao <jiang.bi...@zte.com.cn> --- arch/x86/mm/pti.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index be9e5bc..bb6f608 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -239,8 +239,10 @@ static pmd_t *pti_user_pagetable_walk_pmd(unsigned long address) static __init pte_t *pti_user_pagetable_walk_pte(unsigned long address) { gfp_t gfp = (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO); - pmd_t *pmd = pti_user_pagetable_walk_pmd(address); pte_t *pte; + pmd_t *pmd = pti_user_pagetable_walk_pmd(address); + if (WARN_ON(!pmd)) + return NULL; /* We can't do anything sensible if we hit a large mapping. */ if (pmd_large(*pmd)) { -- 2.7.4