Skip to content

Commit f19c354

Browse files
mjbommarMarc Zyngier
authored andcommitted
KVM: arm64: vgic: Free private_irqs when init fails after allocation
Companion to commit 250f253 ("KVM: arm64: Tear down vGIC on failed vCPU creation"), which added the missing kvm_vgic_vcpu_destroy() call to the kvm_share_hyp() failure path in kvm_arch_vcpu_create(). The kvm_vgic_vcpu_init() failure path immediately above it has the same shape and still needs the same cleanup. Call kvm_vgic_vcpu_destroy() when kvm_vgic_vcpu_init() fails so private IRQs allocated before a redistributor iodev registration failure are released before the failed vCPU is freed. Fixes: 03b3d00 ("KVM: arm64: vgic: Allocate private interrupts on demand") Cc: stable@vger.kernel.org Cc: Will Deacon <will@kernel.org> Reviewed-by: Yuan Yao <yaoyuan@linux.alibaba.com> Assisted-by: Claude:claude-opus-4-7 Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Link: https://lore.kernel.org/r/20260519135042.2219239-1-michael.bommarito@gmail.com Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 9ce754e commit f19c354

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

arch/arm64/kvm/arm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,10 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
555555
kvm_destroy_mpidr_data(vcpu->kvm);
556556

557557
err = kvm_vgic_vcpu_init(vcpu);
558-
if (err)
558+
if (err) {
559+
kvm_vgic_vcpu_destroy(vcpu);
559560
return err;
561+
}
560562

561563
err = kvm_share_hyp(vcpu, vcpu + 1);
562564
if (err)

0 commit comments

Comments
 (0)