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

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
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -521,14 +521,19 @@ static void vfio_pci_release(void *device_data)
		vfio_pci_vf_token_user_add(vdev, -1);
		vfio_spapr_pci_eeh_release(vdev->pdev);
		vfio_pci_disable(vdev);
		mutex_lock(&vdev->igate);
		if (vdev->err_trigger) {
			eventfd_ctx_put(vdev->err_trigger);
			vdev->err_trigger = NULL;
		}
		mutex_unlock(&vdev->igate);

		mutex_lock(&vdev->igate);
		if (vdev->req_trigger) {
			eventfd_ctx_put(vdev->req_trigger);
			vdev->req_trigger = NULL;
		}
		mutex_unlock(&vdev->igate);
	}

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