diff options
author | Jason Gunthorpe <[email protected]> | 2024-09-10 17:00:34 -0300 |
---|---|---|
committer | Joerg Roedel <[email protected]> | 2024-09-12 09:21:40 +0200 |
commit | 3ab9d8d1b50b516507655b10e19d8e624ad1d79c (patch) | |
tree | 385645ac5a0e424fb71971482a119fc87e7f1963 | |
parent | f0295913c4b4f377c454e06f50c1a04f2f80d9df (diff) |
iommu/amd: Test for PAGING domains before freeing a domain
This domain free function can be called for IDENTITY and SVA domains too,
and they don't have page tables. For now protect against this by checking
the type. Eventually the different types should have their own free
functions.
Fixes: 485534bfccb2 ("iommu/amd: Remove conditions from domain free paths")
Reported-by: Vasant Hegde <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Vasant Hegde <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Joerg Roedel <[email protected]>
-rw-r--r-- | drivers/iommu/amd/iommu.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 2876ac42ae2d..f4dfabb3e14d 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -2254,7 +2254,8 @@ static void cleanup_domain(struct protection_domain *domain) void protection_domain_free(struct protection_domain *domain) { WARN_ON(!list_empty(&domain->dev_list)); - free_io_pgtable_ops(&domain->iop.pgtbl.ops); + if (domain->domain.type & __IOMMU_DOMAIN_PAGING) + free_io_pgtable_ops(&domain->iop.pgtbl.ops); domain_id_free(domain->id); kfree(domain); } |