[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1531713820-24544-3-git-send-email-jiang.biao2@zte.com.cn>
Date: Mon, 16 Jul 2018 12:03:37 +0800
From: Jiang Biao <jiang.biao2@....com.cn>
To: tglx@...utronix.de, mingo@...hat.com
Cc: dave.hansen@...ux.intel.com, luto@...nel.org, hpa@...or.com,
x86@...nel.org, albcamus@...il.com, linux-kernel@...r.kernel.org,
zhong.weidong@....com.cn, jiang.biao2@....com.cn
Subject: [PATCH 2/5] x86/pti: check the return value of pti_user_pagetable_walk_pmd
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.biao2@....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
Powered by blists - more mailing lists