RE: [PATCH v4 16/19] vfio: Add VFIO_DEVICE_BIND_IOMMUFD

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

 



> From: Tian, Kevin <kevin.tian@xxxxxxxxx>
> Sent: Wednesday, February 22, 2023 3:40 PM
> 
> > From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
> > Sent: Tuesday, February 21, 2023 11:48 AM
> >
> > +
> > +void vfio_device_cdev_close(struct vfio_device_file *df)
> > +{
> > +	struct vfio_device *device = df->device;
> > +
> > +	mutex_lock(&device->dev_set->lock);
> > +	if (!smp_load_acquire(&df->access_granted)) {
> 
> there is no contention with another one changing this flag at this
> point so directly accessing it is fine.

make sense. 

> but actually should check device->open_count as v3 does. Otherwise
> the last error on copy_to_user() in ioctl_bind_iommufd() simply returns
> here given df->access_granted hasn't been set but .open_device()
> has been completed.

If copy_to_user() failed, vfio_device_close() would be called in the
error path. Then this close function just returns.

Regards,
Yi Liu




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux