History

KVM: emulate: avoid accessing NULL ctxt->memopp

A failure to decode the instruction can cause a NULL pointer access. This is fixed simply by moving the "done" label as close as possible to the return. This fixes CVE-2014-8481.

Paolo Bonzini committed 12 years ago

Commit a430c911 parent 08da44a1 file · +1 −1Browse files

Unified · Split

arch/x86/kvm/emulate.c+1−1
@@ -4580,10 +4580,10 @@ done_prefixes: · 4579 unmodified lines
45804580 /* Decode and fetch the destination operand: register or memory. */
45814581 rc = decode_operand(ctxt, &ctxt->dst, (ctxt->d >> DstShift) & OpMask);
45824582
4583−done:
45844583 if (ctxt->rip_relative)
45854584 ctxt->memopp->addr.mem.ea += ctxt->_eip;
45864585
4586+done:
45874587 return (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK;
45884588 }
45894589

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t