diff options
author | Huacai Chen <chenhc@lemote.com> | 2015-06-04 02:53:47 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-06-06 04:21:10 -0400 |
commit | e1fb96e064e7157920f043f40ae801a5c18e57da (patch) | |
tree | 86df4259ada205a7cf700ca0ed3a70486e262697 /arch | |
parent | 5f35b9cd553fd64415b563497d05a563c988dbd6 (diff) |
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.
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: http://patchwork.linux-mips.org/patch/10524/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/loongson/loongson-3/smp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/mips/loongson/loongson-3/smp.c b/arch/mips/loongson/loongson-3/smp.c index e3c68b5da18d..509877c6e9d9 100644 --- a/arch/mips/loongson/loongson-3/smp.c +++ b/arch/mips/loongson/loongson-3/smp.c | |||
@@ -272,7 +272,7 @@ void loongson3_ipi_interrupt(struct pt_regs *regs) | |||
272 | if (action & SMP_ASK_C0COUNT) { | 272 | if (action & SMP_ASK_C0COUNT) { |
273 | BUG_ON(cpu != 0); | 273 | BUG_ON(cpu != 0); |
274 | c0count = read_c0_count(); | 274 | c0count = read_c0_count(); |
275 | for (i = 1; i < loongson_sysconf.nr_cpus; i++) | 275 | for (i = 1; i < num_possible_cpus(); i++) |
276 | per_cpu(core0_c0count, i) = c0count; | 276 | per_cpu(core0_c0count, i) = c0count; |
277 | } | 277 | } |
278 | } | 278 | } |