* [PATCH] iommufd: Check the domain owner of the parent before creating a nesting domain
@ 2024-08-29 13:19 Jason Gunthorpe
2024-08-29 16:19 ` Nicolin Chen
2024-09-05 15:01 ` Jason Gunthorpe
0 siblings, 2 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2024-08-29 13:19 UTC (permalink / raw)
To: iommu; +Cc: Kevin Tian, Nicolin Chen, patches, Yi Liu
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")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
drivers/iommu/iommufd/hw_pagetable.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c
index aefde4443671ed..d06bf6e6c19fd2 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(
base-commit: d2138b9e6ff3f3261b68066313b69adc05af1929
--
2.46.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iommufd: Check the domain owner of the parent before creating a nesting domain
2024-08-29 13:19 [PATCH] iommufd: Check the domain owner of the parent before creating a nesting domain Jason Gunthorpe
@ 2024-08-29 16:19 ` Nicolin Chen
2024-09-05 15:01 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Nicolin Chen @ 2024-08-29 16:19 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: iommu, Kevin Tian, patches, Yi Liu
On Thu, Aug 29, 2024 at 10:19:59AM -0300, Jason Gunthorpe wrote:
> 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")
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommufd: Check the domain owner of the parent before creating a nesting domain
2024-08-29 13:19 [PATCH] iommufd: Check the domain owner of the parent before creating a nesting domain Jason Gunthorpe
2024-08-29 16:19 ` Nicolin Chen
@ 2024-09-05 15:01 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2024-09-05 15:01 UTC (permalink / raw)
To: iommu; +Cc: Kevin Tian, Nicolin Chen, patches, Yi Liu
On Thu, Aug 29, 2024 at 10:19:59AM -0300, Jason Gunthorpe wrote:
> 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")
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/iommu/iommufd/hw_pagetable.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Applied to for-next, thanks
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-05 15:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-29 13:19 [PATCH] iommufd: Check the domain owner of the parent before creating a nesting domain Jason Gunthorpe
2024-08-29 16:19 ` Nicolin Chen
2024-09-05 15:01 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox