diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2014-01-14 23:12:55 (GMT) |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2014-01-14 23:12:55 (GMT) |
commit | 3be3a074cf5ba641529d8fdae0e05ca642f23e12 (patch) | |
tree | ae0c3fc80319e33c7618c63706a9c9dd98842b79 /drivers/vfio/pci/vfio_pci.c | |
parent | d10999016f4164e9b80f1b3dece3842087cfa3bb (diff) | |
download | linux-3be3a074cf5ba641529d8fdae0e05ca642f23e12.tar.xz |
vfio-pci: Don't use device_lock around AER interrupt setup
device_lock is much too prone to lockups. For instance if we have a
pending .remove then device_lock is already held. If userspace
attempts to modify AER signaling after that point, a deadlock occurs.
eventfd setup/teardown is already protected in vfio with the igate
mutex. AER is not a high performance interrupt, so we can also use
the same mutex to protect signaling versus setup races.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/pci/vfio_pci.c')
-rw-r--r-- | drivers/vfio/pci/vfio_pci.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 6ab71b9..3ffd27f 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -883,9 +883,13 @@ static pci_ers_result_t vfio_pci_aer_err_detected(struct pci_dev *pdev, return PCI_ERS_RESULT_DISCONNECT; } + mutex_lock(&vdev->igate); + if (vdev->err_trigger) eventfd_signal(vdev->err_trigger, 1); + mutex_unlock(&vdev->igate); + vfio_device_put(device); return PCI_ERS_RESULT_CAN_RECOVER; |