Messages in this thread | | | From | "Tian, Kevin" <> | Subject | RE: [PATCH v4] vfio: fix potential deadlock on vfio group lock | Date | Tue, 17 Jan 2023 09:05:40 +0000 |
| |
> From: Matthew Rosato <mjrosato@linux.ibm.com> > Sent: Saturday, January 14, 2023 8:04 AM > > void vfio_device_group_close(struct vfio_device *device) > { > + void (*put_kvm)(struct kvm *kvm); > + struct kvm *kvm; > + > mutex_lock(&device->group->group_lock); > + kvm = device->kvm; > + put_kvm = device->put_kvm; > vfio_device_close(device, device->group->iommufd); > + if (kvm == device->kvm) > + kvm = NULL;
Add a simple comment that this check is to detect the last close
> +void vfio_kvm_put_kvm(void (*put)(struct kvm *kvm), struct kvm *kvm) > +{ > + if (WARN_ON(!put)) > + return;
also WARN_ON(!kvm)?
otherwise this looks good to me:
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
| |