Commit f19c354d authored by Michael Bommarito's avatar Michael Bommarito Committed by Marc Zyngier
Browse files

KVM: arm64: vgic: Free private_irqs when init fails after allocation



Companion to commit 250f2536 ("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: 03b3d00a ("KVM: arm64: vgic: Allocate private interrupts on demand")
Cc: stable@vger.kernel.org
Cc: Will Deacon <will@kernel.org>
Reviewed-by: default avatarYuan Yao <yaoyuan@linux.alibaba.com>
Assisted-by: Claude:claude-opus-4-7
Signed-off-by: default avatarMichael Bommarito <michael.bommarito@gmail.com>
Link: https://lore.kernel.org/r/20260519135042.2219239-1-michael.bommarito@gmail.com


Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent 9ce754ed
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -555,8 +555,10 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
	kvm_destroy_mpidr_data(vcpu->kvm);

	err = kvm_vgic_vcpu_init(vcpu);
	if (err)
	if (err) {
		kvm_vgic_vcpu_destroy(vcpu);
		return err;
	}

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