@@ -4373,6 +4373,9 @@ static void kvm_mmu_finish_page_fault(struct kvm_vcpu *vcpu,
lockdep_assert_once(lockdep_is_held(&vcpu->kvm->mmu_lock) ||
r == RET_PF_RETRY);
+ if (!fault->refcounted_page)
+ return;
+
/*
* If the page that KVM got from the *primary MMU* is writable, and KVM
* installed or reused a SPTE, mark the page/folio dirty. Note, this
@@ -4384,9 +4387,9 @@ static void kvm_mmu_finish_page_fault(struct kvm_vcpu *vcpu,
* folio dirty if KVM could locklessly make the SPTE writable.
*/
if (!fault->map_writable || r == RET_PF_RETRY)
- kvm_release_pfn_clean(fault->pfn);
+ kvm_release_page_clean(fault->refcounted_page);
else
- kvm_release_pfn_dirty(fault->pfn);
+ kvm_release_page_dirty(fault->refcounted_page);
}
static int kvm_mmu_faultin_pfn_private(struct kvm_vcpu *vcpu,