diff options
author | Mark Salter <msalter@redhat.com> | 2017-03-24 09:53:56 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2017-03-30 17:14:32 +0100 |
commit | 335d2c2d192266358c5dfa64953a4c162f46e464 (patch) | |
tree | a4fb36583f7b7c162d33cf882f250e5e070d7e08 /arch/arm64 | |
parent | c02ed2e75ef4c74e41e421acb4ef1494671585e8 (diff) | |
download | linux-335d2c2d192266358c5dfa64953a4c162f46e464.tar.gz linux-335d2c2d192266358c5dfa64953a4c162f46e464.tar.bz2 linux-335d2c2d192266358c5dfa64953a4c162f46e464.zip |
arm64: fix NULL dereference in have_cpu_die()
Commit 5c492c3f5255 ("arm64: smp: Add function to determine if cpus are
stuck in the kernel") added a helper function to determine if die() is
supported in cpu_ops. This function assumes a cpu will have a valid
cpu_ops entry, but that may not be the case for cpu0 is spin-table or
parking protocol is used to boot secondary cpus. In that case, there
is a NULL dereference if have_cpu_die() is called by cpu0. So add a
check for a valid cpu_ops before dereferencing it.
Fixes: 5c492c3f5255 ("arm64: smp: Add function to determine if cpus are stuck in the kernel")
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/kernel/smp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index ef1caae02110..9b1036570586 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -944,7 +944,7 @@ static bool have_cpu_die(void) #ifdef CONFIG_HOTPLUG_CPU int any_cpu = raw_smp_processor_id(); - if (cpu_ops[any_cpu]->cpu_die) + if (cpu_ops[any_cpu] && cpu_ops[any_cpu]->cpu_die) return true; #endif return false; |