KVM: arm64: vgic: Ensure that slots_lock is held in vgic_register_all_redist_iodevs()
authorMarc Zyngier <maz@kernel.org>
Thu, 7 Dec 2023 15:12:00 +0000 (15:12 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Tue, 12 Dec 2023 07:11:38 +0000 (07:11 +0000)
Although we implicitly depend on slots_lock being held when registering
IO devices with the IO bus infrastructure, we don't enforce this
requirement. Make it explicit.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20231207151201.3028710-5-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/vgic/vgic-mmio-v3.c

index 0f039d4..a764b0a 100644 (file)
@@ -833,6 +833,8 @@ static int vgic_register_all_redist_iodevs(struct kvm *kvm)
        unsigned long c;
        int ret = 0;
 
+       lockdep_assert_held(&kvm->slots_lock);
+
        kvm_for_each_vcpu(c, vcpu, kvm) {
                ret = vgic_register_redist_iodev(vcpu);
                if (ret)