]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: SEV: Mark nested locking of kvm->lock
authorWanpeng Li <wanpengli@tencent.com>
Wed, 5 Jan 2022 06:41:03 +0000 (22:41 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Jan 2022 17:01:55 +0000 (12:01 -0500)
Both source and dest vms' kvm->locks are held in sev_lock_two_vms.
Mark one with a different subtype to avoid false positives from lockdep.

Fixes: 1f700abd1d20f (KVM: SEV: accept signals in sev_lock_two_vms)
Reported-by: Yiru Xu <xyru1999@gmail.com>
Tested-by: Jinrong Liang <cloudliang@tencent.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Message-Id: <1641364863-26331-1-git-send-email-wanpengli@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/sev.c

index 7656a2c5662a68425716469b4f94cb164368cb01..be288314122098bfa661d3a37df245227b098ada 100644 (file)
@@ -1565,7 +1565,7 @@ static int sev_lock_two_vms(struct kvm *dst_kvm, struct kvm *src_kvm)
        r = -EINTR;
        if (mutex_lock_killable(&dst_kvm->lock))
                goto release_src;
-       if (mutex_lock_killable(&src_kvm->lock))
+       if (mutex_lock_killable_nested(&src_kvm->lock, SINGLE_DEPTH_NESTING))
                goto unlock_dst;
        return 0;