Skip to content

Commit 9eb1813

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: vgic: Hold config_lock while tearing down a CPU interface
Tearing down a vcpu CPU interface involves freeing the private interrupt array. If we don't hold the lock, we may race against another thread trying to configure it. Yeah, fuzzers do wonderful things... Taking the lock early solves this particular problem. Fixes: 03b3d00 ("KVM: arm64: vgic: Allocate private interrupts on demand") Reported-by: Alexander Potapenko <[email protected]> Tested-by: Alexander Potapenko <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent ad51845 commit 9eb1813

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/arm64/kvm/vgic/vgic-init.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,13 @@ void kvm_vgic_destroy(struct kvm *kvm)
438438
unsigned long i;
439439

440440
mutex_lock(&kvm->slots_lock);
441+
mutex_lock(&kvm->arch.config_lock);
441442

442443
vgic_debug_destroy(kvm);
443444

444445
kvm_for_each_vcpu(i, vcpu, kvm)
445446
__kvm_vgic_vcpu_destroy(vcpu);
446447

447-
mutex_lock(&kvm->arch.config_lock);
448-
449448
kvm_vgic_dist_destroy(kvm);
450449

451450
mutex_unlock(&kvm->arch.config_lock);

0 commit comments

Comments
 (0)