diff options
author | Vasant Hegde | 2022-09-12 06:32:44 +0000 |
---|---|---|
committer | Joerg Roedel | 2022-09-26 13:25:20 +0200 |
commit | 053bab4c220be7749b7d7e101d9d172f3991b21a (patch) | |
tree | d90bf7a21e83c75f4daacfd4e33b5da4d94f52f6 /drivers/iommu | |
parent | d799a183da39ac4988b62da8978950efa177ba9f (diff) |
iommu/amd: Free domain id in error path
Call domain_id_free() in error path.
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Link: https://lore.kernel.org/r/20220912063248.7909-2-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/amd/iommu.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 6bfcac8de1f4..c55f4a129b1e 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -2027,8 +2027,10 @@ static int protection_domain_init_v1(struct protection_domain *domain, int mode) if (mode != PAGE_MODE_NONE) { pt_root = (void *)get_zeroed_page(GFP_KERNEL); - if (!pt_root) + if (!pt_root) { + domain_id_free(domain->id); return -ENOMEM; + } } amd_iommu_domain_set_pgtable(domain, pt_root, mode); @@ -2092,8 +2094,10 @@ static struct protection_domain *protection_domain_alloc(unsigned int type) goto out_err; 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; + } return domain; out_err: |