[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y9gDkUc0rMFjHd2w@nvidia.com>
Date: Mon, 30 Jan 2023 13:51:13 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Robin Murphy <robin.murphy@....com>
Cc: joro@...tes.org, will@...nel.org, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, hch@....de, baolu.lu@...ux.intel.com
Subject: Re: [PATCH v2 5/8] iommu: Switch __iommu_domain_alloc() to device ops
On Thu, Jan 26, 2023 at 06:26:20PM +0000, Robin Murphy wrote:
> @@ -1980,9 +1978,30 @@ static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus,
> return domain;
> }
>
> +static int __iommu_domain_alloc_dev(struct device *dev, void *data)
> +{
> + struct device **alloc_dev = data;
> +
> + if (!dev_iommu_ops_valid(dev))
> + return 0;
This valid check is necessary to be done in __iommu_domain_alloc()
because the callback coming from iommu_device_claim_dma_owner() never
validated that the device/group has an iommu driver:
> @@ -3120,13 +3139,13 @@ static int __iommu_group_alloc_blocking_domain(struct iommu_group *group)
> if (group->blocking_domain)
> return 0;
>
> - group->blocking_domain = __iommu_domain_alloc(dev->bus, IOMMU_DOMAIN_BLOCKED);
> + group->blocking_domain = __iommu_domain_alloc(dev, IOMMU_DOMAIN_BLOCKED);
Jason
Powered by blists - more mailing lists