Re: [PATCH v2 2/8] iommu: Validate that devices match domains

From: Jason Gunthorpe
Date: Mon Jan 30 2023 - 10:59:37 EST


On Thu, Jan 26, 2023 at 06:26:17PM +0000, Robin Murphy wrote:

> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> index 3589d1b8f922..86fa52025e75 100644
> --- a/include/linux/iommu.h
> +++ b/include/linux/iommu.h
> @@ -95,6 +95,7 @@ struct iommu_domain_geometry {
> struct iommu_domain {
> unsigned type;
> const struct iommu_domain_ops *ops;
> + const struct iommu_ops *owner; /* Whose domain_alloc we came from */

For some reason I thought we were trying to save bytes in this struct?

Putting a pointer back to iommu_ops in iommu_domain_ops would allow
that, then it is just domain->ops->owner

Regardless,

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Jason