diff options
author | Jeffrey Deans <jeffrey.deans@imgtec.com> | 2014-07-17 04:20:56 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-08-01 18:06:40 -0400 |
commit | 6096e114f5f70d29d9e01e031f69d529b2193ab7 (patch) | |
tree | a274820cc1a74ff159399d079e2d0277a60783f5 /arch/mips/kernel/irq-gic.c | |
parent | b0a88ae50220b60d6e9686fc5f5a200151217037 (diff) |
MIPS: GIC: Prevent array overrun
A GIC interrupt which is declared as having a GIC_MAP_TO_NMI_MSK
mapping causes the cpu parameter to gic_setup_intr() to be increased
to 32, causing memory corruption when pcpu_masks[] is written to again
later in the function.
Signed-off-by: Jeffrey Deans <jeffrey.deans@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: stable@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7375/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/irq-gic.c')
-rw-r--r-- | arch/mips/kernel/irq-gic.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c index 71cf45a335b6..9932aef91abb 100644 --- a/arch/mips/kernel/irq-gic.c +++ b/arch/mips/kernel/irq-gic.c | |||
@@ -281,11 +281,13 @@ static void __init gic_setup_intr(unsigned int intr, unsigned int cpu, | |||
281 | 281 | ||
282 | /* Setup Intr to Pin mapping */ | 282 | /* Setup Intr to Pin mapping */ |
283 | if (pin & GIC_MAP_TO_NMI_MSK) { | 283 | if (pin & GIC_MAP_TO_NMI_MSK) { |
284 | int i; | ||
285 | |||
284 | GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_MAP_TO_PIN(intr)), pin); | 286 | GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_MAP_TO_PIN(intr)), pin); |
285 | /* FIXME: hack to route NMI to all cpu's */ | 287 | /* FIXME: hack to route NMI to all cpu's */ |
286 | for (cpu = 0; cpu < NR_CPUS; cpu += 32) { | 288 | for (i = 0; i < NR_CPUS; i += 32) { |
287 | GICWRITE(GIC_REG_ADDR(SHARED, | 289 | GICWRITE(GIC_REG_ADDR(SHARED, |
288 | GIC_SH_MAP_TO_VPE_REG_OFF(intr, cpu)), | 290 | GIC_SH_MAP_TO_VPE_REG_OFF(intr, i)), |
289 | 0xffffffff); | 291 | 0xffffffff); |
290 | } | 292 | } |
291 | } else { | 293 | } else { |