Skip to content

Commit 73183ad

Browse files
committed
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: bd529db ("iommufd: Add a nested HW pagetable object") Link: https://patch.msgid.link/r/0-v1-c8770519edde+1a-iommufd_nesting_ops_jgg@nvidia.com Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 76889bb commit 73183ad

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/iommu/iommufd/hw_pagetable.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ iommufd_hwpt_nested_alloc(struct iommufd_ctx *ictx,
225225
if ((flags & ~IOMMU_HWPT_FAULT_ID_VALID) ||
226226
!user_data->len || !ops->domain_alloc_user)
227227
return ERR_PTR(-EOPNOTSUPP);
228-
if (parent->auto_domain || !parent->nest_parent)
228+
if (parent->auto_domain || !parent->nest_parent ||
229+
parent->common.domain->owner != ops)
229230
return ERR_PTR(-EINVAL);
230231

231232
hwpt_nested = __iommufd_object_alloc(

0 commit comments

Comments
 (0)