> From: Jason Gunthorpe <j...@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.

Reply via email to