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 <[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]>
1 parent f029591 commit 3ab9d8d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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)