]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Don't re-acquire SRCU lock in complete_emulated_io()
authorSean Christopherson <seanjc@google.com>
Fri, 15 Apr 2022 00:43:41 +0000 (00:43 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 21 Apr 2022 17:16:10 +0000 (13:16 -0400)
commit9258001bfe53c875e4a8b0ab6afcc39ee85d1ef3
treeb4c9319b2267ebb8baf7986d0a87316c27f53440
parentab5ed78ff395b7b51247d53d84f7d514d2f5a234
KVM: x86: Don't re-acquire SRCU lock in complete_emulated_io()

Don't re-acquire SRCU in complete_emulated_io() now that KVM acquires the
lock in kvm_arch_vcpu_ioctl_run().  More importantly, don't overwrite
vcpu->srcu_idx.  If the index acquired by complete_emulated_io() differs
from the one acquired by kvm_arch_vcpu_ioctl_run(), KVM will effectively
leak a lock and hang if/when synchronize_srcu() is invoked for the
relevant grace period.

Fixes: a7b7f3d93b37 ("KVM: x86: pull kvm->srcu read-side to kvm_arch_vcpu_ioctl_run")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20220415004343.2203171-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c