Skip to content

Commit 4fa640d

Browse files
committed
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
2 parents 5714ee5 + b872d06 commit 4fa640d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/vfio/pci/vfio_pci.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,14 +521,19 @@ static void vfio_pci_release(void *device_data)
521521
vfio_pci_vf_token_user_add(vdev, -1);
522522
vfio_spapr_pci_eeh_release(vdev->pdev);
523523
vfio_pci_disable(vdev);
524+
mutex_lock(&vdev->igate);
524525
if (vdev->err_trigger) {
525526
eventfd_ctx_put(vdev->err_trigger);
526527
vdev->err_trigger = NULL;
527528
}
529+
mutex_unlock(&vdev->igate);
530+
531+
mutex_lock(&vdev->igate);
528532
if (vdev->req_trigger) {
529533
eventfd_ctx_put(vdev->req_trigger);
530534
vdev->req_trigger = NULL;
531535
}
536+
mutex_unlock(&vdev->igate);
532537
}
533538

534539
mutex_unlock(&vdev->reflck->lock);

0 commit comments

Comments
 (0)