From: Avi Kivity <avi@qumranet.com>
Date: Wed, 30 Apr 2008 13:13:36 +0000 (+0300)
Subject: KVM: x86 emulator: disable writeback on lmsw
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dc7457ea52f88539dc72925360e6068d5c938a0f;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git

KVM: x86 emulator: disable writeback on lmsw

The recent changes allowing memory operands with lmsw and smsw left
lmsw with writeback enabled.  Since lmsw has no oridinary destination
operand, the dst pointer was not initialized, resulting in an oops.

Close the hole by disabling writeback for lmsw.

Signed-off-by: Avi Kivity <avi@qumranet.com>
---

diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index 2ca08386f99..f2a696d6a24 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -1761,6 +1761,7 @@ twobyte_insn:
 		case 6: /* lmsw */
 			realmode_lmsw(ctxt->vcpu, (u16)c->src.val,
 				      &ctxt->eflags);
+			c->dst.type = OP_NONE;
 			break;
 		case 7: /* invlpg*/
 			emulate_invlpg(ctxt->vcpu, memop);