iommu/amd: Fix pages leak in free_pagetable()
authorAndrei Dulea <adulea@amazon.de>
Fri, 13 Sep 2019 14:42:28 +0000 (16:42 +0200)
committerJoerg Roedel <jroedel@suse.de>
Tue, 24 Sep 2019 09:15:09 +0000 (11:15 +0200)
Take into account the gathered freelist in free_sub_pt(), otherwise we
end up leaking all that pages.

Fixes: 409afa44f9ba ("iommu/amd: Introduce free_sub_pt() function")
Signed-off-by: Andrei Dulea <adulea@amazon.de>
drivers/iommu/amd_iommu.c

index 1ed3b98324bac09ce8399b2ee0ad445e08802d20..13854744634513d5dfbd2fe0b67f7f06ac021861 100644 (file)
@@ -1425,7 +1425,7 @@ static void free_pagetable(struct protection_domain *domain)
        BUG_ON(domain->mode < PAGE_MODE_NONE ||
               domain->mode > PAGE_MODE_6_LEVEL);
 
-       free_sub_pt(root, domain->mode, freelist);
+       freelist = free_sub_pt(root, domain->mode, freelist);
 
        free_page_list(freelist);
 }