Skip to content

Commit d725c7a

Browse files
committed
Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull CPU hotplug fix from Thomas Gleixner: "A single fix to handle the removal of the first dynamic CPU hotplug state correctly" * 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: smp/hotplug: Handle removal correctly in cpuhp_store_callbacks()
2 parents 93cc122 + 0c96b27 commit d725c7a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

kernel/cpu.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,17 @@ static int cpuhp_store_callbacks(enum cpuhp_state state, const char *name,
12531253
struct cpuhp_step *sp;
12541254
int ret = 0;
12551255

1256-
if (state == CPUHP_AP_ONLINE_DYN || state == CPUHP_BP_PREPARE_DYN) {
1256+
/*
1257+
* If name is NULL, then the state gets removed.
1258+
*
1259+
* CPUHP_AP_ONLINE_DYN and CPUHP_BP_PREPARE_DYN are handed out on
1260+
* the first allocation from these dynamic ranges, so the removal
1261+
* would trigger a new allocation and clear the wrong (already
1262+
* empty) state, leaving the callbacks of the to be cleared state
1263+
* dangling, which causes wreckage on the next hotplug operation.
1264+
*/
1265+
if (name && (state == CPUHP_AP_ONLINE_DYN ||
1266+
state == CPUHP_BP_PREPARE_DYN)) {
12571267
ret = cpuhp_reserve_state(state);
12581268
if (ret < 0)
12591269
return ret;

0 commit comments

Comments
 (0)