Skip to contentSkip to conversation

MIPS: Loongson-3: Fix a cpu-hotplug issue in loongson3_ipi_interrupt()

PATCH Applied Huacai Chen 2 participants 2 messages Jun 4, 2015 – Jun 5, 2015 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: Loongson-3: Fix a cpu-hotplug issue in loongson3_ipi_interrupt()

setup_per_cpu_areas() only setup __per_cpu_offset[] for each possible cpu, but loongson_sysconf.nr_cpus can be greater than possible cpus (due to reserved_cpus_mask). So in loongson3_ipi_interrupt(), percpu access will touch the original varible in .data..percpu section which has been freed. Without this patch, cpu-hotplug will cause memery corruption.

---
 arch/mips/loongson/loongson-3/smp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/mips/loongson/loongson-3/smp.c +1 -1
index e3c68b5..509877c 100644
@@ -272,7 +272,7 @@ void loongson3_ipi_interrupt(struct pt_regs *regs)
 	if (action & SMP_ASK_C0COUNT) {
 		BUG_ON(cpu != 0);
 		c0count = read_c0_count();
-		for (i = 1; i < loongson_sysconf.nr_cpus; i++)
+		for (i = 1; i < num_possible_cpus(); i++)
 			per_cpu(core0_c0count, i) = c0count;
 	}
 }
Signature · 1 line
1.7.7.3