diff mbox series

[v3,1/5] vhost: fix the fd leak

Message ID 20230731121018.2856310-2-fengli@smartx.com
State New
Headers show
Series Implement reconnect for vhost-user-scsi | expand

Commit Message

Li Feng July 31, 2023, 12:10 p.m. UTC
When the vhost-user reconnect to the backend, the notifer should be
cleanup. Otherwise, the fd resource will be exhausted.

Fixes: f9a09ca3ea ("vhost: add support for configure interrupt")

Signed-off-by: Li Feng <fengli@smartx.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
---
 hw/virtio/vhost.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Fiona Ebner Aug. 3, 2023, 1:41 p.m. UTC | #1
Am 31.07.23 um 14:10 schrieb Li Feng:
> When the vhost-user reconnect to the backend, the notifer should be
> cleanup. Otherwise, the fd resource will be exhausted.
> 
> Fixes: f9a09ca3ea ("vhost: add support for configure interrupt")
> 
> Signed-off-by: Li Feng <fengli@smartx.com>
> Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>

Tested-by: Fiona Ebner <f.ebner@proxmox.com>

Thank you for the fix! CC-ing stable, because the issue is present since
8.0.0.
diff mbox series

Patch

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index abf0d03c8d..e2f6ffb446 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -2044,6 +2044,8 @@  void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings)
     event_notifier_test_and_clear(
         &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);
     event_notifier_test_and_clear(&vdev->config_notifier);
+    event_notifier_cleanup(
+        &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);
 
     trace_vhost_dev_stop(hdev, vdev->name, vrings);