Commit 3ab4ac87 authored by Lai Jiangshan's avatar Lai Jiangshan Committed by Paolo Bonzini

KVM: VMX: Update msr value after kvm_set_user_return_msr() succeeds

Aoid earlier modification.
Signed-off-by: default avatarLai Jiangshan <laijs@linux.alibaba.com>
Message-Id: <20211118110814.2568-4-jiangshanlai@gmail.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 6ab8a405
...@@ -602,15 +602,13 @@ static int vmx_set_guest_uret_msr(struct vcpu_vmx *vmx, ...@@ -602,15 +602,13 @@ static int vmx_set_guest_uret_msr(struct vcpu_vmx *vmx,
unsigned int slot = msr - vmx->guest_uret_msrs; unsigned int slot = msr - vmx->guest_uret_msrs;
int ret = 0; int ret = 0;
u64 old_msr_data = msr->data;
msr->data = data;
if (msr->load_into_hardware) { if (msr->load_into_hardware) {
preempt_disable(); preempt_disable();
ret = kvm_set_user_return_msr(slot, msr->data, msr->mask); ret = kvm_set_user_return_msr(slot, data, msr->mask);
preempt_enable(); preempt_enable();
if (ret)
msr->data = old_msr_data;
} }
if (!ret)
msr->data = data;
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment