提交 053bab4c 编写于 作者: V Vasant Hegde 提交者: Joerg Roedel

iommu/amd: Free domain id in error path

Call domain_id_free() in error path.
Signed-off-by: NVasant Hegde <vasant.hegde@amd.com>
Link: https://lore.kernel.org/r/20220912063248.7909-2-vasant.hegde@amd.comSigned-off-by: NJoerg Roedel <jroedel@suse.de>
上级 d799a183
...@@ -2027,8 +2027,10 @@ static int protection_domain_init_v1(struct protection_domain *domain, int mode) ...@@ -2027,8 +2027,10 @@ static int protection_domain_init_v1(struct protection_domain *domain, int mode)
if (mode != PAGE_MODE_NONE) { if (mode != PAGE_MODE_NONE) {
pt_root = (void *)get_zeroed_page(GFP_KERNEL); pt_root = (void *)get_zeroed_page(GFP_KERNEL);
if (!pt_root) if (!pt_root) {
domain_id_free(domain->id);
return -ENOMEM; return -ENOMEM;
}
} }
amd_iommu_domain_set_pgtable(domain, pt_root, mode); amd_iommu_domain_set_pgtable(domain, pt_root, mode);
...@@ -2092,8 +2094,10 @@ static struct protection_domain *protection_domain_alloc(unsigned int type) ...@@ -2092,8 +2094,10 @@ static struct protection_domain *protection_domain_alloc(unsigned int type)
goto out_err; goto out_err;
pgtbl_ops = alloc_io_pgtable_ops(pgtable, &domain->iop.pgtbl_cfg, domain); pgtbl_ops = alloc_io_pgtable_ops(pgtable, &domain->iop.pgtbl_cfg, domain);
if (!pgtbl_ops) if (!pgtbl_ops) {
domain_id_free(domain->id);
goto out_err; goto out_err;
}
return domain; return domain;
out_err: out_err:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册