Skip to content

Commit 3ab9d8d

Browse files
jgunthorpejoergroedel
authored andcommitted
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: 485534b ("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> Link: https://lore.kernel.org/r/0-v1-ad9884ee5f5b+da-amd_iopgtbl_fix_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent f029591 commit 3ab9d8d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/iommu/amd/iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2254,7 +2254,8 @@ static void cleanup_domain(struct protection_domain *domain)
22542254
void protection_domain_free(struct protection_domain *domain)
22552255
{
22562256
WARN_ON(!list_empty(&domain->dev_list));
2257-
free_io_pgtable_ops(&domain->iop.pgtbl.ops);
2257+
if (domain->domain.type & __IOMMU_DOMAIN_PAGING)
2258+
free_io_pgtable_ops(&domain->iop.pgtbl.ops);
22582259
domain_id_free(domain->id);
22592260
kfree(domain);
22602261
}

0 commit comments

Comments
 (0)