Skip to content
Snippets Groups Projects
Commit d74196bb authored by Jerry Snitselaar's avatar Jerry Snitselaar Committed by Greg Kroah-Hartman
Browse files

iommu/vt-d: Clean up si_domain in the init_dmars() error path


[ Upstream commit 620bf9f981365c18cc2766c53d92bf8131c63f32 ]

A splat from kmem_cache_destroy() was seen with a kernel prior to
commit ee2653bbe89d ("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 <baolu.lu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Fixes: 86080ccc ("iommu/vt-d: Allocate si_domain in init_dmars()")
Signed-off-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
Link: https://lore.kernel.org/r/20221010144842.308890-1-jsnitsel@redhat.com


Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ef11e8ec
No related branches found
No related tags found
1 merge request!15.10.61 -> 5.10.152 upgrade
...@@ -2846,6 +2846,7 @@ static int __init si_domain_init(int hw) ...@@ -2846,6 +2846,7 @@ static int __init si_domain_init(int hw)
if (md_domain_init(si_domain, DEFAULT_DOMAIN_ADDRESS_WIDTH)) { if (md_domain_init(si_domain, DEFAULT_DOMAIN_ADDRESS_WIDTH)) {
domain_exit(si_domain); domain_exit(si_domain);
si_domain = NULL;
return -EFAULT; return -EFAULT;
} }
...@@ -3505,6 +3506,10 @@ static int __init init_dmars(void) ...@@ -3505,6 +3506,10 @@ static int __init init_dmars(void)
disable_dmar_iommu(iommu); disable_dmar_iommu(iommu);
free_dmar_iommu(iommu); free_dmar_iommu(iommu);
} }
if (si_domain) {
domain_exit(si_domain);
si_domain = NULL;
}
kfree(g_iommus); kfree(g_iommus);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment