Skip to content

Commit 053bab4

Browse files
hegdevasantjoergroedel
authored andcommitted
iommu/amd: Free domain id in error path
Call domain_id_free() in error path. Signed-off-by: Vasant Hegde <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent d799a18 commit 053bab4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,8 +2027,10 @@ static int protection_domain_init_v1(struct protection_domain *domain, int mode)
20272027

20282028
if (mode != PAGE_MODE_NONE) {
20292029
pt_root = (void *)get_zeroed_page(GFP_KERNEL);
2030-
if (!pt_root)
2030+
if (!pt_root) {
2031+
domain_id_free(domain->id);
20312032
return -ENOMEM;
2033+
}
20322034
}
20332035

20342036
amd_iommu_domain_set_pgtable(domain, pt_root, mode);
@@ -2092,8 +2094,10 @@ static struct protection_domain *protection_domain_alloc(unsigned int type)
20922094
goto out_err;
20932095

20942096
pgtbl_ops = alloc_io_pgtable_ops(pgtable, &domain->iop.pgtbl_cfg, domain);
2095-
if (!pgtbl_ops)
2097+
if (!pgtbl_ops) {
2098+
domain_id_free(domain->id);
20962099
goto out_err;
2100+
}
20972101

20982102
return domain;
20992103
out_err:

0 commit comments

Comments
 (0)