]> git.baikalelectronics.ru Git - kernel.git/commit
irqchip/mips-gic: Don't overrun pcpu_masks array
authorPaul Burton <paul.burton@imgtec.com>
Thu, 21 Apr 2016 10:31:54 +0000 (11:31 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 21 Apr 2016 19:04:29 +0000 (21:04 +0200)
commit28252b5717cdfb2fb525a220702674de8bec7f88
treedd870503ba69eec8a7eef85189e4f235d52222d4
parent101a3f0aaf67d02117157ad31c996ca89710b04a
irqchip/mips-gic: Don't overrun pcpu_masks array

Commit 29987217399a ("irqchip/mips-gic: Use gic_vpes instead of
NR_CPUS") & commit 1fc45ae1fe40 ("irqchip/mips-gic: Clear percpu_masks
correctly when mapping") both introduce code which accesses gic_vpes
entries in the pcpu_masks array. However, this array has length NR_CPUS.
If NR_CPUS is less than gic_vpes (ie. the kernel supports use of less
CPUs than are present in the system) then we overrun the array, clobber
some other data & generally die pretty promptly.

Most notably this affects uniprocessor kernels running on any multicore
or multithreaded Malta with a GIC (ie. the vast majority of real Malta
boards).

Fix this by only accessing up to min(gic_vpes, NR_CPUS) entries in the
pcpu_masks array, preventing the array overrun.

Fixes: 29987217399a ("irqchip/mips-gic: Use gic_vpes instead of NR_CPUS")
Fixes: 1fc45ae1fe40 ("irqchip/mips-gic: Clear percpu_masks correctly when mapping")
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Link: http://lkml.kernel.org/r/1461234714-9975-1-git-send-email-paul.burton@imgtec.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
drivers/irqchip/irq-mips-gic.c