From: Prasad Pandit Date: Mon, 29 May 2023 11:43:33 +0000 (+0530) Subject: vhost: release virtqueue objects in error path X-Git-Tag: qemu-xen-4.18.0-rc5~90 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=46fe2deaefb0d72036f47029ff8f7a10904e775c;p=qemu-xen.git vhost: release virtqueue objects in error path vhost_dev_start function does not release virtqueue objects when event_notifier_init() function fails. Release virtqueue objects and log a message about function failure. Signed-off-by: Prasad Pandit Message-Id: <20230529114333.31686-3-ppandit@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Fixes: f9a09ca3ea ("vhost: add support for configure interrupt") Reviewed-by: Peter Xu Cc: qemu-stable@nongnu.org Acked-by: Jason Wang (cherry picked from commit 77ece20ba04582d94c345ac0107ddff2fd18d27a) Signed-off-by: Michael Tokarev --- diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 7c87f1328b..58bd9ab82a 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1956,7 +1956,8 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings) r = event_notifier_init( &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier, 0); if (r < 0) { - return r; + VHOST_OPS_DEBUG(r, "event_notifier_init failed"); + goto fail_vq; } event_notifier_test_and_clear( &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);