]> err.no Git - linux-2.6/commitdiff
KVM: VMX: Only reload guest msrs if they are already loaded
authorAvi Kivity <avi@qumranet.com>
Sun, 6 May 2007 13:10:01 +0000 (16:10 +0300)
committerAvi Kivity <avi@qumranet.com>
Mon, 16 Jul 2007 09:05:41 +0000 (12:05 +0300)
If we set an msr via an ioctl() instead of by handling a guest exit, we
have the host state loaded, so reloading the msrs would clobber host
state instead of guest state.

This fixes a host oops (and loss of a cpu) on a guest reboot.

Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/vmx.c

index 096cb6a1e89999be88b38423dcaf14f4df54c598..b353eaa0a4418ea22324061e4b1a0ceabfffa9e0 100644 (file)
@@ -600,7 +600,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
                msr = find_msr_entry(vcpu, msr_index);
                if (msr)
                        msr->data = data;
-               load_msrs(vcpu->guest_msrs, NR_BAD_MSRS);
+               if (vcpu->vmx_host_state.loaded)
+                       load_msrs(vcpu->guest_msrs, NR_BAD_MSRS);
                break;
 #endif
        case MSR_IA32_SYSENTER_CS: