Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vfio/pci: Use pci_try_reset_function() on initial open
Device lock bites again; if a device .remove() callback races a user calling ioctl(VFIO_GROUP_GET_DEVICE_FD), the unbind request will hold the device lock, but the user ioctl may have already taken a vfio_device reference. In the case of a PCI device, the initial open will attempt to reset the device, which again attempts to get the device lock, resulting in deadlock. Use the trylock PCI reset interface and return error on the open path if reset fails due to lock contention. Link: https://lkml.org/lkml/2017/7/25/381 Reported-by: Wen Congyang <[email protected]> Signed-off-by: Alex Williamson <[email protected]>
- Loading branch information