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/[email protected] Reviewed-by: Nicolin Chen <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 76889bb commit 73183ad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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)