kernel_samsung_a53x/arch/arm64/kvm/vgic
Oliver Upton f2a1bdd4e3 KVM: arm64: vgic-v2: Check for non-NULL vCPU in vgic_v2_parse_attr()
[ Upstream commit 6ddb4f372fc63210034b903d96ebbeb3c7195adb ]

vgic_v2_parse_attr() is responsible for finding the vCPU that matches
the user-provided CPUID, which (of course) may not be valid. If the ID
is invalid, kvm_get_vcpu_by_id() returns NULL, which isn't handled
gracefully.

Similar to the GICv3 uaccess flow, check that kvm_get_vcpu_by_id()
actually returns something and fail the ioctl if not.

Cc: stable@vger.kernel.org
Fixes: 7d450e282171 ("KVM: arm/arm64: vgic-new: Add userland access to VGIC dist registers")
Reported-by: Alexander Potapenko <glider@google.com>
Tested-by: Alexander Potapenko <glider@google.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20240424173959.3776798-2-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 11:32:43 +01:00
..
trace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vgic-debug.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vgic-init.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vgic-irqfd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vgic-its.c KVM: arm64: vgic-its: Test for valid IRQ in its_sync_lpi_pending_table() 2024-11-18 22:25:37 +01:00
vgic-kvm-device.c KVM: arm64: vgic-v2: Check for non-NULL vCPU in vgic_v2_parse_attr() 2024-11-19 11:32:43 +01:00
vgic-mmio-v2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vgic-mmio-v3.c KVM: arm64: vgic-v4: Restore pending state on host userspace write 2024-11-18 12:12:48 +01:00
vgic-mmio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vgic-mmio.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vgic-v2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vgic-v3.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vgic-v4.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vgic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vgic.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00