]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
KVM: MMU: Fix another largepage memory leak
authorJoerg Roedel <joerg.roedel@amd.com>
Thu, 19 Feb 2009 11:18:56 +0000 (12:18 +0100)
committerAvi Kivity <avi@redhat.com>
Tue, 24 Mar 2009 09:03:11 +0000 (11:03 +0200)
In the paging_fetch function rmap_remove is called after setting a large
pte to non-present. This causes rmap_remove to not drop the reference to
the large page. The result is a memory leak of that page.

Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/paging_tmpl.h

index 7314c0944c5f77e66a43b10bd41d0687c40b8edb..0f11792fafa6d6ca3899a6fd6c9093587f691644 100644 (file)
@@ -306,9 +306,9 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
                        continue;
 
                if (is_large_pte(*sptep)) {
+                       rmap_remove(vcpu->kvm, sptep);
                        set_shadow_pte(sptep, shadow_trap_nonpresent_pte);
                        kvm_flush_remote_tlbs(vcpu->kvm);
-                       rmap_remove(vcpu->kvm, sptep);
                }
 
                if (level == PT_DIRECTORY_LEVEL