RE: [PATCH v2] vfio: Move "device->open_count--" out of group_rwsem in vfio_device_open()

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

 



> From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
> Sent: Monday, June 27, 2022 3:41 PM
> 
> We do not protect the vfio_device::open_count with group_rwsem
> elsewhere (see
> vfio_device_fops_release as a comparison, where we already drop
> group_rwsem
> before open_count--). So move the group_rwsem unlock prior to
> open_count--.
> 
> This change now also drops group_rswem before setting device->kvm = NULL,
> but that's also OK (again, just like vfio_device_fops_release). The setting
> of device->kvm before open_device is technically done while holding the
> group_rwsem, this is done to protect the group kvm value we are copying
> from,
> and we should not be relying on that to protect the contents of device->kvm;
> instead we assume this value will not change until after the device is closed
> and while under the dev_set->lock.
> 
> Cc: Matthew Rosato <mjrosato@xxxxxxxxxxxxx>
> Cc: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Signed-off-by: Yi Liu <yi.l.liu@xxxxxxxxx>
> Reviewed-by: Matthew Rosato <mjrosato@xxxxxxxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>




[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