From: Gleb Natapov Date: Wed, 5 Oct 2011 12:01:24 +0000 (+0200) Subject: KVM: VMX: Check for automatic switch msr table overflow X-Git-Tag: v3.2-rc3~26^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7fc6f93b4242b2b566f0070709e27257d6da8a2;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git KVM: VMX: Check for automatic switch msr table overflow Signed-off-by: Gleb Natapov Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 98f4b0b..579a0b5 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1280,7 +1280,11 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr, if (m->guest[i].index == msr) break; - if (i == m->nr) { + if (i == NR_AUTOLOAD_MSRS) { + printk_once(KERN_WARNING"Not enough mst switch entries. " + "Can't add msr %x\n", msr); + return; + } else if (i == m->nr) { ++m->nr; vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, m->nr); vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, m->nr);