KVM: use correct accessor function for __kvm_memslots
authorChristian Borntraeger <borntraeger@de.ibm.com>
Fri, 7 Jul 2017 13:49:00 +0000 (15:49 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Mon, 10 Jul 2017 10:28:46 +0000 (12:28 +0200)
kvm memslots are protected by srcu and not by rcu. We must use
srcu_dereference_check instead of rcu_dereference_check.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
include/linux/kvm_host.h

index b3ca77a96b2d7520f37007f3ab0746e229d4616e..648b34cabb38214e6bb957aeecbcf61e03a26d4c 100644 (file)
@@ -568,9 +568,8 @@ void kvm_put_kvm(struct kvm *kvm);
 
 static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id)
 {
-       return rcu_dereference_check(kvm->memslots[as_id],
-                       srcu_read_lock_held(&kvm->srcu)
-                       || lockdep_is_held(&kvm->slots_lock));
+       return srcu_dereference_check(kvm->memslots[as_id], &kvm->srcu,
+                       lockdep_is_held(&kvm->slots_lock));
 }
 
 static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)