summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2017-06-16 16:09:58 +0200
committerJoerg Roedel <jroedel@suse.de>2017-06-22 12:54:20 +0200
commitf601927136d69be49f0a14ae820b44c02fa591ba (patch)
treed9a257e13d87ff0fe163fc36fa4c5c796b2baf1b /drivers/iommu
parentiommu/amd: Check for error states first in iommu_go_to_state() (diff)
downloadlinux-f601927136d69be49f0a14ae820b44c02fa591ba.tar.xz
linux-f601927136d69be49f0a14ae820b44c02fa591ba.zip
iommu/amd: Set global pointers to NULL after freeing them
Avoid any tries to double-free these pointers. Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu_init.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index a6b81a05a0d1..8cc507f96f3a 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -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();
}