kvm_swap_active_memslots() updates kvm->memslots[as_id] while holding both kvm->slots_lock and kvm->slots_arch_lock. Holding either lock guarantees that memslots cannot be concurrently modified. Allow reading memslots in __kvm_memslots() when kvm->slots_arch_lock is held. Signed-off-by: Marco Elver --- include/linux/kvm_host.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 03bfc92864b6..5ed8260ef01f 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1089,6 +1089,7 @@ static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id) as_id = array_index_nospec(as_id, KVM_MAX_NR_ADDRESS_SPACES); return srcu_dereference_check(kvm->memslots[as_id], &kvm->srcu, lockdep_is_held(&kvm->slots_lock) || + lockdep_is_held(&kvm->slots_arch_lock) || !refcount_read(&kvm->users_count)); } -- 2.55.0.1003.g10538fe699-goog