KVM: x86: Explicitly state lockdep condition of msr_filter update
authorMichal Luczaj <mhal@rbox.co>
Sat, 7 Jan 2023 00:12:54 +0000 (01:12 +0100)
committerSean Christopherson <seanjc@google.com>
Fri, 3 Feb 2023 23:30:39 +0000 (15:30 -0800)
Replace `1` with the actual mutex_is_locked() check.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Michal Luczaj <mhal@rbox.co>
Link: https://lore.kernel.org/r/20230107001256.2365304-5-mhal@rbox.co
[sean: delete the comment that explained the hardocded '1']
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/x86.c

index 9c66cb3657b45c57d4c2ea31d3ac2a2ca29029f4..00e4bf16bbfd7f2f5d934e7eaecde57b9e3a3f6d 100644 (file)
@@ -6492,8 +6492,8 @@ static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm,
        }
 
        mutex_lock(&kvm->lock);
-       /* The per-VM filter is protected by kvm->lock... */
-       old_filter = rcu_replace_pointer(kvm->arch.msr_filter, new_filter, 1);
+       old_filter = rcu_replace_pointer(kvm->arch.msr_filter, new_filter,
+                                        mutex_is_locked(&kvm->lock));
        mutex_unlock(&kvm->lock);
        synchronize_srcu(&kvm->srcu);