aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/paging_tmpl.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 15e379eaf3b0..22f13797f521 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -586,7 +586,7 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
586 unsigned pte_access; 586 unsigned pte_access;
587 pt_element_t gpte; 587 pt_element_t gpte;
588 gpa_t pte_gpa; 588 gpa_t pte_gpa;
589 gfn_t gfn = sp->gfns[i]; 589 gfn_t gfn;
590 590
591 if (!is_shadow_present_pte(sp->spt[i])) 591 if (!is_shadow_present_pte(sp->spt[i]))
592 continue; 592 continue;
@@ -597,8 +597,9 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
597 sizeof(pt_element_t))) 597 sizeof(pt_element_t)))
598 return -EINVAL; 598 return -EINVAL;
599 599
600 if (gpte_to_gfn(gpte) != gfn || !is_present_gpte(gpte) || 600 gfn = gpte_to_gfn(gpte);
601 !(gpte & PT_ACCESSED_MASK)) { 601 if (unalias_gfn(vcpu->kvm, gfn) != sp->gfns[i] ||
602 !is_present_gpte(gpte) || !(gpte & PT_ACCESSED_MASK)) {
602 u64 nonpresent; 603 u64 nonpresent;
603 604
604 rmap_remove(vcpu->kvm, &sp->spt[i]); 605 rmap_remove(vcpu->kvm, &sp->spt[i]);