arm64: fix NULL dereference in have_cpu_die()
authorMark Salter <msalter@redhat.com>
Fri, 24 Mar 2017 13:53:56 +0000 (09:53 -0400)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 23 Jul 2017 03:07:22 +0000 (03:07 +0000)
commit75540216fa0e723f9dbcb6f7f2fbd5e3d9a3c00f
tree4ea9fb47cc8b2a86a8a69f821e79d0986716f5ac
parent87fed7f6ac49dc41d9d03c7d8070a5e258fc6274
arm64: fix NULL dereference in have_cpu_die()

commit 335d2c2d192266358c5dfa64953a4c162f46e464 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kernel/smp.c