提交 5c5866c5 编写于 作者: A Alex Williamson

vfio/pci: Clear error and request eventfd ctx after releasing

The next use of the device will generate an underflow from the
stale reference.

Cc: Qian Cai <cai@lca.pw>
Fixes: 1518ac27 ("vfio/pci: fix memory leaks of eventfd ctx")
Reported-by: NDaniel Wagner <dwagner@suse.de>
Reviewed-by: NCornelia Huck <cohuck@redhat.com>
Tested-by: NDaniel Wagner <dwagner@suse.de>
Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
上级 b3a9e3b9
......@@ -521,10 +521,14 @@ 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);
if (vdev->err_trigger)
if (vdev->err_trigger) {
eventfd_ctx_put(vdev->err_trigger);
if (vdev->req_trigger)
vdev->err_trigger = NULL;
}
if (vdev->req_trigger) {
eventfd_ctx_put(vdev->req_trigger);
vdev->req_trigger = NULL;
}
}
mutex_unlock(&vdev->reflck->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册