aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gunthorpe <[email protected]>2024-08-29 10:19:59 -0300
committerJason Gunthorpe <[email protected]>2024-09-05 11:25:40 -0300
commit73183ad6ea51029d04b098286dcee98d715015f1 (patch)
tree4a360ea2d7b902327bf4be5720f8629a8baa2dc1
parent76889bbaabf5cab981a74ed69cb3816921edc5d4 (diff)
iommufd: Check the domain owner of the parent before creating a nesting domain
This check was missed, before we can pass a struct iommu_domain to a driver callback we need to validate that the domain was created by that driver. Fixes: bd529dbb661d ("iommufd: Add a nested HW pagetable object") Link: https://patch.msgid.link/r/[email protected] Reviewed-by: Nicolin Chen <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
-rw-r--r--drivers/iommu/iommufd/hw_pagetable.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c
index aefde4443671..d06bf6e6c19f 100644
--- a/drivers/iommu/iommufd/hw_pagetable.c
+++ b/drivers/iommu/iommufd/hw_pagetable.c
@@ -225,7 +225,8 @@ iommufd_hwpt_nested_alloc(struct iommufd_ctx *ictx,
if ((flags & ~IOMMU_HWPT_FAULT_ID_VALID) ||
!user_data->len || !ops->domain_alloc_user)
return ERR_PTR(-EOPNOTSUPP);
- if (parent->auto_domain || !parent->nest_parent)
+ if (parent->auto_domain || !parent->nest_parent ||
+ parent->common.domain->owner != ops)
return ERR_PTR(-EINVAL);
hwpt_nested = __iommufd_object_alloc(