From: Avi Kivity Date: Sat, 6 Jan 2007 00:36:52 +0000 (-0800) Subject: [PATCH] KVM: MMU: Free pages on kvm destruction X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f51234c2cd3ab8bed836e09686e27877e1b55f2a;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] KVM: MMU: Free pages on kvm destruction Because mmu pages have attached rmap and parent pte chain structures, we need to zap them before freeing so the attached structures are freed. Signed-off-by: Avi Kivity Acked-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index f16321498093..0bd2a19709ce 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c @@ -1065,9 +1065,14 @@ EXPORT_SYMBOL_GPL(kvm_mmu_free_some_pages); static void free_mmu_pages(struct kvm_vcpu *vcpu) { - while (!list_empty(&vcpu->free_pages)) { - struct kvm_mmu_page *page; + struct kvm_mmu_page *page; + while (!list_empty(&vcpu->kvm->active_mmu_pages)) { + page = container_of(vcpu->kvm->active_mmu_pages.next, + struct kvm_mmu_page, link); + kvm_mmu_zap_page(vcpu, page); + } + while (!list_empty(&vcpu->free_pages)) { page = list_entry(vcpu->free_pages.next, struct kvm_mmu_page, link); list_del(&page->link);