Re: [PATCH v4 13/17] iommufd: Add kAPI toward external drivers for kernel access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 14, 2022 at 08:25:35AM +0000, Tian, Kevin wrote:
> > From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> > Sent: Tuesday, November 8, 2022 8:49 AM
> > 
> > Callers must provide a callback that immediately unpins any IOVA being
> > used within a range. This happens if userspace unmaps the IOVA under the
> > pin.
> 
> with 'must' then let's add a check in iommufd_access_create() on the
> unmap callback.

What I did is put it on the iommufd_access_pin_pages() call, since it
is fine to use rw without providing an callback

> > +struct iommufd_access *
> > +iommufd_access_create(struct iommufd_ctx *ictx, u32 ioas_id,
> > +		      const struct iommufd_access_ops *ops, void *data)
> > +{
> > +	struct iommufd_access *access;
> > +	struct iommufd_object *obj;
> > +	int rc;
> > +
> > +	/*
> > +	 * There is no uAPI for the access object, but to keep things
> > symmetric
> > +	 * use the object infrastructure anyhow.
> > +	 */
> > +	access = iommufd_object_alloc(ictx, access, IOMMUFD_OBJ_ACCESS);
> > +	if (IS_ERR(access))
> > +		return access;
> > +
> > +	access->data = data;
> > +	access->ops = ops;
> > +	access->ictx = ictx;
> 
> I didn't see other places referencing access->ictx before this func
> succeeds. But just to be robust it's always cleaner to put this line
> together with iommufd_ctx_get().

OK

Thanks,
Jason



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux