From: Li Feng Date: Mon, 31 Jul 2023 12:10:06 +0000 (+0800) Subject: vhost: fix the fd leak X-Git-Tag: qemu-xen-4.18.0-rc5~20 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=fd902c54e57fc3e0d1daef3dd979a1dd47caa2e5;p=qemu-xen.git vhost: fix the fd leak 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 Reviewed-by: Raphael Norwitz Message-Id: <20230731121018.2856310-2-fengli@smartx.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Tested-by: Fiona Ebner (cherry picked from commit 18f2971ce403008d5e1c2875b483c9d1778143dc) Signed-off-by: Michael Tokarev --- diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 480e7f8048..f394d69a0f 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -2059,6 +2059,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);