aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/mmu/mmu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index fe3f3bc0bb79..f3a4ed6afec2 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -4393,7 +4393,9 @@ static void kvm_mmu_finish_page_fault(struct kvm_vcpu *vcpu,
* fault handler, and so KVM must (somewhat) speculatively mark the
* folio dirty if KVM could locklessly make the SPTE writable.
*/
- if (!fault->map_writable || r == RET_PF_RETRY)
+ if (r == RET_PF_RETRY)
+ kvm_release_page_unused(fault->refcounted_page);
+ else if (!fault->map_writable)
kvm_release_page_clean(fault->refcounted_page);
else
kvm_release_page_dirty(fault->refcounted_page);