Skip to content

Commit 620bf9f

Browse files
snitsjoergroedel
authored andcommitted
iommu/vt-d: Clean up si_domain in the init_dmars() error path
A splat from kmem_cache_destroy() was seen with a kernel prior to commit ee2653b ("iommu/vt-d: Remove domain and devinfo mempool") when there was a failure in init_dmars(), because the iommu_domain cache still had objects. While the mempool code is now gone, there still is a leak of the si_domain memory if init_dmars() fails. So clean up si_domain in the init_dmars() error path. Cc: Lu Baolu <[email protected]> Cc: Joerg Roedel <[email protected]> Cc: Will Deacon <[email protected]> Cc: Robin Murphy <[email protected]> Fixes: 86080cc ("iommu/vt-d: Allocate si_domain in init_dmars()") Signed-off-by: Jerry Snitselaar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lu Baolu <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent 5566e68 commit 620bf9f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,6 +2410,7 @@ static int __init si_domain_init(int hw)
24102410

24112411
if (md_domain_init(si_domain, DEFAULT_DOMAIN_ADDRESS_WIDTH)) {
24122412
domain_exit(si_domain);
2413+
si_domain = NULL;
24132414
return -EFAULT;
24142415
}
24152416

@@ -3052,6 +3053,10 @@ static int __init init_dmars(void)
30523053
disable_dmar_iommu(iommu);
30533054
free_dmar_iommu(iommu);
30543055
}
3056+
if (si_domain) {
3057+
domain_exit(si_domain);
3058+
si_domain = NULL;
3059+
}
30553060

30563061
return ret;
30573062
}

0 commit comments

Comments
 (0)