]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm/arm64: vgic: Prevent access to invalid SPIs
authorAndre Przywara <andre.przywara@arm.com>
Tue, 1 Nov 2016 18:00:08 +0000 (18:00 +0000)
committerMarc Zyngier <marc.zyngier@arm.com>
Fri, 4 Nov 2016 17:56:54 +0000 (17:56 +0000)
commit784b02e6348c2ecf0ec78b8bc15620f53b3a52f1
tree0145a35a2e65e9cbc713ec2d56dd04c3b9ea6216
parent08d2712b518ca65dfd5b7c284720a4ba4f207a01
KVM: arm/arm64: vgic: Prevent access to invalid SPIs

In our VGIC implementation we limit the number of SPIs to a number
that the userland application told us. Accordingly we limit the
allocation of memory for virtual IRQs to that number.
However in our MMIO dispatcher we didn't check if we ever access an
IRQ beyond that limit, leading to out-of-bound accesses.
Add a test against the number of allocated SPIs in check_region().
Adjust the VGIC_ADDR_TO_INT macro to avoid an actual division, which
is not implemented on ARM(32).

[maz: cleaned-up original patch]

Cc: stable@vger.kernel.org
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
virt/kvm/arm/vgic/vgic-mmio.c
virt/kvm/arm/vgic/vgic-mmio.h