qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Si-Wei Liu <si-wei.liu@oracle.com>
To: qemu-devel@nongnu.org
Cc: mst@redhat.com, jasowang@redhat.com, eperezma@redhat.com,
	eli@mellanox.com, si-wei.liu@oracle.com, sgarzare@redhat.com
Subject: [PATCH v2 3/5] vhost-vdpa: fix improper cleanup in net_init_vhost_vdpa
Date: Wed, 27 Apr 2022 01:30:14 -0700	[thread overview]
Message-ID: <1651048216-3365-4-git-send-email-si-wei.liu@oracle.com> (raw)
In-Reply-To: <1651048216-3365-1-git-send-email-si-wei.liu@oracle.com>

... such that no memory leaks on dangling net clients in case of
error.

Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
Acked-by: Jason Wang <jasowang@redhat.com>
---
 net/vhost-vdpa.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 1e9fe47..df1e69e 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -306,7 +306,9 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
 
 err:
     if (i) {
-        qemu_del_net_client(ncs[0]);
+        for (i--; i >= 0; i--) {
+            qemu_del_net_client(ncs[i]);
+        }
     }
     qemu_close(vdpa_device_fd);
 
-- 
1.8.3.1



  parent reply	other threads:[~2022-04-27  8:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27  8:30 [PATCH v2 0/5] vhost-vdpa multiqueue fixes Si-Wei Liu
2022-04-27  8:30 ` [PATCH v2 1/5] virtio-net: setup vhost_dev and notifiers for cvq only when feature is negotiated Si-Wei Liu
2022-04-29  2:14   ` Jason Wang
2022-04-27  8:30 ` [PATCH v2 2/5] virtio-net: align ctrl_vq index for non-mq guest for vhost_vdpa Si-Wei Liu
2022-04-29  2:23   ` Jason Wang
2022-04-29  2:24     ` Jason Wang
2022-04-30  1:13       ` Si-Wei Liu
2022-04-30  1:12     ` Si-Wei Liu
2022-05-05  8:25       ` Jason Wang
2022-04-27  8:30 ` Si-Wei Liu [this message]
2022-04-27  8:30 ` [PATCH v2 4/5] vhost-net: fix improper cleanup in vhost_net_start Si-Wei Liu
2022-04-27  8:30 ` [PATCH v2 5/5] vhost-vdpa: backend feature should set only once Si-Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1651048216-3365-4-git-send-email-si-wei.liu@oracle.com \
    --to=si-wei.liu@oracle.com \
    --cc=eli@mellanox.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).