From: Lai Jiangshan Date: Thu, 18 Nov 2021 11:08:02 +0000 (+0800) Subject: KVM: VMX: Update msr value after kvm_set_user_return_msr() succeeds X-Git-Tag: v6.6.17~8235^2~188 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ab4ac877cfabd209d12cbd6af0aa02077bb778d;p=platform%2Fkernel%2Flinux-rpi.git KVM: VMX: Update msr value after kvm_set_user_return_msr() succeeds Aoid earlier modification. Signed-off-by: Lai Jiangshan Message-Id: <20211118110814.2568-4-jiangshanlai@gmail.com> Signed-off-by: Paolo Bonzini --- diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 56c46a5..73cb132 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -602,15 +602,13 @@ static int vmx_set_guest_uret_msr(struct vcpu_vmx *vmx, unsigned int slot = msr - vmx->guest_uret_msrs; int ret = 0; - u64 old_msr_data = msr->data; - msr->data = data; if (msr->load_into_hardware) { 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(); - if (ret) - msr->data = old_msr_data; } + if (!ret) + msr->data = data; return ret; }