[PATCH 3/3] KVM: arm64: vgic: Gracefully handle resetting an unallocated interrupt
Marc Zyngier
maz at kernel.org
Thu Feb 6 07:21:00 PST 2025
Playing with racing vcpu reset and vgic teardown makes it relatively
easy to trigger a case where, by the time we try to reset a mapped
interrupt such as a timer's, the vgic is gone and there is no
interrupt to play with.
Check for NULL upfront to avoid further embarassement.
Reported-by: Alexander Potapenko <glider at google.com>
Signed-off-by: Marc Zyngier <maz at kernel.org>
---
arch/arm64/kvm/vgic/vgic.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c
index f454cef59e24b..2ea6d1d1d3091 100644
--- a/arch/arm64/kvm/vgic/vgic.c
+++ b/arch/arm64/kvm/vgic/vgic.c
@@ -542,6 +542,9 @@ void kvm_vgic_reset_mapped_irq(struct kvm_vcpu *vcpu, u32 vintid)
struct vgic_irq *irq = vgic_get_vcpu_irq(vcpu, vintid);
unsigned long flags;
+ if (!irq)
+ return;
+
if (!irq->hw)
goto out;
--
2.39.2
More information about the linux-arm-kernel
mailing list