Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a22436b7b8ec9b14a0451d9ac0fdc9d370bd7800 Commit: a22436b7b8ec9b14a0451d9ac0fdc9d370bd7800 Parent: e4f8e03956de4b1a1dc4bbbdefa9c973d01ee91f Author: Laurent Vivier <[EMAIL PROTECTED]> AuthorDate: Mon Sep 24 17:00:58 2007 +0200 Committer: Avi Kivity <[EMAIL PROTECTED]> CommitDate: Wed Jan 30 17:52:49 2008 +0200
KVM: Purify x86_decode_insn() error case management The only valid case is on protected page access, other cases are errors. Signed-off-by: Laurent Vivier <[EMAIL PROTECTED]> Signed-off-by: Avi Kivity <[EMAIL PROTECTED]> --- drivers/kvm/kvm_main.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 2d55bab..888b092 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c @@ -1251,7 +1251,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu, u16 error_code, int no_decode) { - int r = 0; + int r; vcpu->mmio_fault_cr2 = cr2; kvm_x86_ops->cache_regs(vcpu); @@ -1294,10 +1294,14 @@ int emulate_instruction(struct kvm_vcpu *vcpu, get_segment_base(vcpu, VCPU_SREG_FS); r = x86_decode_insn(&vcpu->emulate_ctxt, &emulate_ops); + if (r) { + if (kvm_mmu_unprotect_page_virt(vcpu, cr2)) + return EMULATE_DONE; + return EMULATE_FAIL; + } } - if (r == 0) - r = x86_emulate_insn(&vcpu->emulate_ctxt, &emulate_ops); + r = x86_emulate_insn(&vcpu->emulate_ctxt, &emulate_ops); if (vcpu->pio.string) return EMULATE_DO_MMIO; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html