mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
kvm: vmx: Fix entry number check for add_atomic_switch_msr()
commit98ae70cc47upstream. Commitca83b4a7f2("x86/KVM/VMX: Add find_msr() helper function") introduces the helper function find_msr(), which returns -ENOENT when not find the msr in vmx->msr_autoload.guest/host. Correct checking contion of no more available entry in vmx->msr_autoload. Fixes:ca83b4a7f2("x86/KVM/VMX: Add find_msr() helper function") Cc: stable@vger.kernel.org Signed-off-by: Xiaoyao Li <xiaoyao.li@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c58f010beb
commit
0d41c03c41
@@ -2757,7 +2757,8 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr,
|
||||
if (!entry_only)
|
||||
j = find_msr(&m->host, msr);
|
||||
|
||||
if (i == NR_AUTOLOAD_MSRS || j == NR_AUTOLOAD_MSRS) {
|
||||
if ((i < 0 && m->guest.nr == NR_AUTOLOAD_MSRS) ||
|
||||
(j < 0 && m->host.nr == NR_AUTOLOAD_MSRS)) {
|
||||
printk_once(KERN_WARNING "Not enough msr switch entries. "
|
||||
"Can't add msr %x\n", msr);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user