Skip to content

Commit

Permalink
[PATCH] KVM: MMU: kvm_mmu_put_page() only removes one link to the page
Browse files Browse the repository at this point in the history
...  and so must not free it unconditionally.

Move the freeing to kvm_mmu_zap_page().

Signed-off-by: Avi Kivity <avi@qumranet.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Avi Kivity authored and Linus Torvalds committed Jan 6, 2007
1 parent 697fe2e commit cc4529e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,6 @@ static void kvm_mmu_put_page(struct kvm_vcpu *vcpu,
u64 *parent_pte)
{
mmu_page_remove_parent_pte(page, parent_pte);
kvm_mmu_page_unlink_children(vcpu, page);
hlist_del(&page->hash_link);
list_del(&page->link);
list_add(&page->link, &vcpu->free_pages);
}

static void kvm_mmu_zap_page(struct kvm_vcpu *vcpu,
Expand All @@ -546,6 +542,10 @@ static void kvm_mmu_zap_page(struct kvm_vcpu *vcpu,
kvm_mmu_put_page(vcpu, page, parent_pte);
*parent_pte = 0;
}
kvm_mmu_page_unlink_children(vcpu, page);
hlist_del(&page->hash_link);
list_del(&page->link);
list_add(&page->link, &vcpu->free_pages);
}

static int kvm_mmu_unprotect_page(struct kvm_vcpu *vcpu, gfn_t gfn)
Expand Down

0 comments on commit cc4529e

Please sign in to comment.