Message ID | 20230529114333.31686-3-ppandit@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | vhost: release memory objects in an error path | expand |
On Mon, May 29, 2023 at 05:13:33PM +0530, P J P wrote: > From: Prasad Pandit <pjp@fedoraproject.org> > > 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 <pjp@fedoraproject.org> Fixes: f9a09ca3ea ("vhost: add support for configure interrupt") Reviewed-by: Peter Xu <peterx@redhat.com> > --- > hw/virtio/vhost.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > v2: split a single patch into two. > > diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c > index 6be4a0626a..1de3029ae7 100644 > --- a/hw/virtio/vhost.c > +++ b/hw/virtio/vhost.c > @@ -1942,7 +1942,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); > -- > 2.40.1 >
On Mon, May 29, 2023 at 7:41 PM P J P <ppandit@redhat.com> wrote: > > From: Prasad Pandit <pjp@fedoraproject.org> > > 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 <pjp@fedoraproject.org> Cc: qemu-stable@nongnu.org Acked-by: Jason Wang <jasowang@redhat.com> Thanks > --- > hw/virtio/vhost.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > v2: split a single patch into two. > > diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c > index 6be4a0626a..1de3029ae7 100644 > --- a/hw/virtio/vhost.c > +++ b/hw/virtio/vhost.c > @@ -1942,7 +1942,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); > -- > 2.40.1 >
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 6be4a0626a..1de3029ae7 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1942,7 +1942,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);