iommu/amd: Set global pointers to NULL after freeing them
authorJoerg Roedel <jroedel@suse.de>
Fri, 16 Jun 2017 14:09:58 +0000 (16:09 +0200)
committerJoerg Roedel <jroedel@suse.de>
Thu, 22 Jun 2017 10:54:20 +0000 (12:54 +0200)
Avoid any tries to double-free these pointers.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd_iommu_init.c

index a6b81a05a0d1e9cfc75a6a719443debf8b21141a..8cc507f96f3a805c4a46a8fceb5f4d3d8de82364 100644 (file)
@@ -2114,18 +2114,22 @@ static void __init free_iommu_resources(void)
        kmemleak_free(irq_lookup_table);
        free_pages((unsigned long)irq_lookup_table,
                   get_order(rlookup_table_size));
+       irq_lookup_table = NULL;
 
        kmem_cache_destroy(amd_iommu_irq_cache);
        amd_iommu_irq_cache = NULL;
 
        free_pages((unsigned long)amd_iommu_rlookup_table,
                   get_order(rlookup_table_size));
+       amd_iommu_rlookup_table = NULL;
 
        free_pages((unsigned long)amd_iommu_alias_table,
                   get_order(alias_table_size));
+       amd_iommu_alias_table = NULL;
 
        free_pages((unsigned long)amd_iommu_dev_table,
                   get_order(dev_table_size));
+       amd_iommu_dev_table = NULL;
 
        free_iommu_all();
 
@@ -2195,6 +2199,7 @@ static void __init free_dma_resources(void)
 {
        free_pages((unsigned long)amd_iommu_pd_alloc_bitmap,
                   get_order(MAX_DOMAIN_ID/8));
+       amd_iommu_pd_alloc_bitmap = NULL;
 
        free_unity_maps();
 }