aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Li <liwei391@huawei.com>2019-03-31 23:55:57 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2019-04-04 11:02:25 -0400
commit1c41860864c8ae0387ef7d44f0000e99cbb2e06d (patch)
tree3eb98c1d7d1707eefe047067f22cf3017460adf4
parent79a3aaa7b82e3106be97842dedfd8429248896e6 (diff)
arm64: fix wrong check of on_sdei_stack in nmi context
When doing unwind_frame() in the context of pseudo nmi (need enable CONFIG_ARM64_PSEUDO_NMI), reaching the bottom of the stack (fp == 0, pc != 0), function on_sdei_stack() will return true while the sdei acpi table is not inited in fact. This will cause a "NULL pointer dereference" oops when going on. Reviewed-by: Julien Thierry <julien.thierry@arm.com> Signed-off-by: Wei Li <liwei391@huawei.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r--arch/arm64/kernel/sdei.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm64/kernel/sdei.c b/arch/arm64/kernel/sdei.c
index 5ba4465e44f0..ea94cf8f9dc6 100644
--- a/arch/arm64/kernel/sdei.c
+++ b/arch/arm64/kernel/sdei.c
@@ -94,6 +94,9 @@ static bool on_sdei_normal_stack(unsigned long sp, struct stack_info *info)
94 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_normal_ptr); 94 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_normal_ptr);
95 unsigned long high = low + SDEI_STACK_SIZE; 95 unsigned long high = low + SDEI_STACK_SIZE;
96 96
97 if (!low)
98 return false;
99
97 if (sp < low || sp >= high) 100 if (sp < low || sp >= high)
98 return false; 101 return false;
99 102
@@ -111,6 +114,9 @@ static bool on_sdei_critical_stack(unsigned long sp, struct stack_info *info)
111 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_critical_ptr); 114 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_critical_ptr);
112 unsigned long high = low + SDEI_STACK_SIZE; 115 unsigned long high = low + SDEI_STACK_SIZE;
113 116
117 if (!low)
118 return false;
119
114 if (sp < low || sp >= high) 120 if (sp < low || sp >= high)
115 return false; 121 return false;
116 122