[Intel-gfx] [PATCH v3 2/6] iommufd: Create access in vfio_iommufd_emulated_bind()

Tian, Kevin kevin.tian at intel.com
Fri Mar 31 08:16:16 UTC 2023


> From: Jason Gunthorpe <jgg at nvidia.com>
> Sent: Thursday, March 30, 2023 4:00 AM
> 
> On Mon, Mar 27, 2023 at 02:33:47AM -0700, Yi Liu wrote:
> > @@ -494,6 +479,30 @@ void iommufd_access_destroy(struct
> iommufd_access *access)
> >  }
> >  EXPORT_SYMBOL_NS_GPL(iommufd_access_destroy, IOMMUFD);
> >
> > +int iommufd_access_attach(struct iommufd_access *access, u32 ioas_id)
> > +{
> > +	struct iommufd_ioas *new_ioas;
> > +	int rc = 0;
> > +
> > +	if (access->ioas != NULL && access->ioas->obj.id != ioas_id)
> > +		return -EINVAL;
> 
> This should just be
> 
>    if (access->ioas)
>         return -EINVAL;

the physical path has the same check:

	if (idev->igroup->hwpt != NULL && idev->igroup->hwpt != hwpt) {
		rc = -EINVAL;
		goto err_unlock;
	}

If we change here then that one should be changed too.


More information about the Intel-gfx mailing list