iommu/amd: Test for PAGING domains before freeing a domain
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 10 Sep 2024 20:00:34 +0000 (17:00 -0300)
committerJoerg Roedel <jroedel@suse.de>
Thu, 12 Sep 2024 07:21:40 +0000 (09:21 +0200)
commit3ab9d8d1b50b516507655b10e19d8e624ad1d79c
tree385645ac5a0e424fb71971482a119fc87e7f1963
parentf0295913c4b4f377c454e06f50c1a04f2f80d9df
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 <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>
drivers/iommu/amd/iommu.c