KVM: MMU: Fix memory leak on guest demand faults
authorAvi Kivity <avi@qumranet.com>
Sun, 23 Mar 2008 12:21:08 +0000 (14:21 +0200)
committerAvi Kivity <avi@qumranet.com>
Tue, 25 Mar 2008 08:22:17 +0000 (10:22 +0200)
While backporting 72dc67a69690288538142df73a7e3ac66fea68dc, a gfn_to_page()
call was duplicated instead of moved (due to an unrelated patch not being
present in mainline).  This caused a page reference leak, resulting in a
fairly massive memory leak.

Fix by removing the extraneous gfn_to_page() call.

Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/mmu.c

index 4ba85d95bd29e737ca9605b726a9acb378c57bb1..e55af12e11b7aeb523ff0296d7e525d2f7a33a6d 100644 (file)
@@ -1412,7 +1412,7 @@ static void mmu_guess_page_from_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
        up_read(&current->mm->mmap_sem);
 
        vcpu->arch.update_pte.gfn = gfn;
-       vcpu->arch.update_pte.page = gfn_to_page(vcpu->kvm, gfn);
+       vcpu->arch.update_pte.page = page;
 }
 
 void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,