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: bd529dbb66
("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>
This commit is contained in:
parent
76889bbaab
commit
73183ad6ea
@ -225,7 +225,8 @@ iommufd_hwpt_nested_alloc(struct iommufd_ctx *ictx,
|
|||||||
if ((flags & ~IOMMU_HWPT_FAULT_ID_VALID) ||
|
if ((flags & ~IOMMU_HWPT_FAULT_ID_VALID) ||
|
||||||
!user_data->len || !ops->domain_alloc_user)
|
!user_data->len || !ops->domain_alloc_user)
|
||||||
return ERR_PTR(-EOPNOTSUPP);
|
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);
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
hwpt_nested = __iommufd_object_alloc(
|
hwpt_nested = __iommufd_object_alloc(
|
||||||
|
Loading…
Reference in New Issue
Block a user