* [PATCH] iommu/amd: Test for PAGING domains before freeing a domain
@ 2024-09-10 20:00 Jason Gunthorpe
2024-09-11 9:36 ` Vasant Hegde
0 siblings, 1 reply; 2+ messages in thread
From: Jason Gunthorpe @ 2024-09-10 20:00 UTC (permalink / raw)
To: iommu, Joerg Roedel, Suravee Suthikulpanit, Will Deacon
Cc: Joerg Roedel, patches, Vasant Hegde
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 <vasant.hegde@amd.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
drivers/iommu/amd/iommu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Joerg please pick or squash for this cycle, thanks
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 2d0a681a205211..154f90e7b98e1d 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -2257,7 +2257,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);
}
base-commit: 22c91287502b4bfc2899a1006709eec8273cf052
--
2.46.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iommu/amd: Test for PAGING domains before freeing a domain
2024-09-10 20:00 [PATCH] iommu/amd: Test for PAGING domains before freeing a domain Jason Gunthorpe
@ 2024-09-11 9:36 ` Vasant Hegde
0 siblings, 0 replies; 2+ messages in thread
From: Vasant Hegde @ 2024-09-11 9:36 UTC (permalink / raw)
To: Jason Gunthorpe, iommu, Joerg Roedel, Suravee Suthikulpanit,
Will Deacon
Cc: Joerg Roedel, patches
On 9/11/2024 1:30 AM, Jason Gunthorpe wrote:
> 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 <vasant.hegde@amd.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
-Vasant
> ---
> drivers/iommu/amd/iommu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> Joerg please pick or squash for this cycle, thanks
>
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index 2d0a681a205211..154f90e7b98e1d 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -2257,7 +2257,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);
> }
>
> base-commit: 22c91287502b4bfc2899a1006709eec8273cf052
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-11 9:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10 20:00 [PATCH] iommu/amd: Test for PAGING domains before freeing a domain Jason Gunthorpe
2024-09-11 9:36 ` Vasant Hegde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox