Skip to content

Commit

Permalink
KVM: use correct accessor function for __kvm_memslots
Browse files Browse the repository at this point in the history
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 <[email protected]>
Suggested-by: Paolo Bonzini <[email protected]>
  • Loading branch information
borntraeger committed Jul 10, 2017
1 parent a80cf7b commit 7e988b1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions include/linux/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7e988b1

Please sign in to comment.