Skip to contentSkip to conversation

Patch "arm64: fix NULL dereference in have_cpu_die()" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jul 3, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

arm64: fix NULL dereference in have_cpu_die()

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
arm64-fix-null-dereference-in-have_cpu_die.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 335d2c2d192266358c5dfa64953a4c162f46e464 Mon Sep 17 00:00:00 2001

From: Mark Salter <[email protected]>
Date: Fri, 24 Mar 2017 09:53:56 -0400
Subject: arm64: fix NULL dereference in have_cpu_die()

From: Mark Salter <[email protected]>

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")
---
 arch/arm64/kernel/smp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/smp.c +1 -1
@@ -934,7 +934,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;

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/arm64-fix-null-dereference-in-have_cpu_die.patch