@@ -4000,6 +4000,8 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
if (r) {
if (kvm_mmu_unprotect_page_virt(vcpu, cr2))
return EMULATE_DONE;
+ if (!kvm_is_error_hva(gfn_to_hva(vcpu->kvm, cr2)))
+ return EMULATE_DONE;
if (emulation_type & EMULTYPE_SKIP)
return EMULATE_FAIL;
return handle_emulation_failure(vcpu);
@@ -4026,6 +4028,8 @@ restart:
*/
if (kvm_mmu_unprotect_page_virt(vcpu, cr2))
return EMULATE_DONE;
+ if (!kvm_is_error_hva(gfn_to_hva(vcpu->kvm, cr2)))
+ return EMULATE_DONE;
return handle_emulation_failure(vcpu);
}