KVM: x86: release time_page on vcpu destruction
authorJoerg Roedel <joerg.roedel@amd.com>
Wed, 25 Feb 2009 15:08:31 +0000 (16:08 +0100)
committerAvi Kivity <avi@redhat.com>
Wed, 22 Apr 2009 10:52:10 +0000 (13:52 +0300)
Not releasing the time_page causes a leak of that page or the compound
page it is situated in.

Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c

index 8ca100a9ecac57db73e4157b291be70373a94573..a1ecec5c03e9a1ea08b6631fb79ecc1082bb9072 100644 (file)
@@ -4159,6 +4159,11 @@ EXPORT_SYMBOL_GPL(kvm_put_guest_fpu);
 
 void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
 {
+       if (vcpu->arch.time_page) {
+               kvm_release_page_dirty(vcpu->arch.time_page);
+               vcpu->arch.time_page = NULL;
+       }
+
        kvm_x86_ops->vcpu_free(vcpu);
 }