Commit 4fa640dc authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'vfio-v5.8-rc7' of git://github.com/awilliam/linux-vfio into master

Pull VFIO fix from Alex Williamson:
 "Fix race with eventfd ctx cleared outside of mutex (Zeng Tao)"

* tag 'vfio-v5.8-rc7' of git://github.com/awilliam/linux-vfio:
  vfio/pci: fix racy on error and request eventfd ctx
parents 5714ee50 b872d064
...@@ -521,14 +521,19 @@ static void vfio_pci_release(void *device_data) ...@@ -521,14 +521,19 @@ static void vfio_pci_release(void *device_data)
vfio_pci_vf_token_user_add(vdev, -1); vfio_pci_vf_token_user_add(vdev, -1);
vfio_spapr_pci_eeh_release(vdev->pdev); vfio_spapr_pci_eeh_release(vdev->pdev);
vfio_pci_disable(vdev); vfio_pci_disable(vdev);
mutex_lock(&vdev->igate);
if (vdev->err_trigger) { if (vdev->err_trigger) {
eventfd_ctx_put(vdev->err_trigger); eventfd_ctx_put(vdev->err_trigger);
vdev->err_trigger = NULL; vdev->err_trigger = NULL;
} }
mutex_unlock(&vdev->igate);
mutex_lock(&vdev->igate);
if (vdev->req_trigger) { if (vdev->req_trigger) {
eventfd_ctx_put(vdev->req_trigger); eventfd_ctx_put(vdev->req_trigger);
vdev->req_trigger = NULL; vdev->req_trigger = NULL;
} }
mutex_unlock(&vdev->igate);
} }
mutex_unlock(&vdev->reflck->lock); mutex_unlock(&vdev->reflck->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment