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
4580 /* Decode and fetch the destination operand: register or memory. */4580 /* Decode and fetch the destination operand: register or memory. */
4581 rc = decode_operand(ctxt, &ctxt->dst, (ctxt->d >> DstShift) & OpMask);4581 rc = decode_operand(ctxt, &ctxt->dst, (ctxt->d >> DstShift) & OpMask);
4582 4582
4583done:
4584 if (ctxt->rip_relative)4583 if (ctxt->rip_relative)
4585 ctxt->memopp->addr.mem.ea += ctxt->_eip;4584 ctxt->memopp->addr.mem.ea += ctxt->_eip;
4586 4585
4586done:
4587 return (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK;4587 return (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK;
4588}4588}
4589 4589

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