Blame SOURCES/kvm-vhost-vdpa-fix-improper-cleanup-in-net_init_vhost_vd.patch

24c150
From b140a9fdeaab84d4a2d8828604ffb6aa8367dcbe Mon Sep 17 00:00:00 2001
24c150
From: Si-Wei Liu <si-wei.liu@oracle.com>
24c150
Date: Fri, 6 May 2022 19:28:14 -0700
24c150
Subject: [PATCH 3/7] vhost-vdpa: fix improper cleanup in net_init_vhost_vdpa
24c150
MIME-Version: 1.0
24c150
Content-Type: text/plain; charset=UTF-8
24c150
Content-Transfer-Encoding: 8bit
24c150
24c150
RH-Author: Cindy Lu <lulu@redhat.com>
24c150
RH-MergeRequest: 204: vdpa :sync the Multiqueue fixes for vhost-vDPA
24c150
RH-Commit: [3/7] 600138cb9945013179f5a3c14f52d637c4b9f6c7
24c150
RH-Bugzilla: 2095795
24c150
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
24c150
RH-Acked-by: Eugenio PĂ©rez <eperezma@redhat.com>
24c150
RH-Acked-by: Jason Wang <jasowang@redhat.com>
24c150
24c150
... such that no memory leaks on dangling net clients in case of
24c150
error.
24c150
24c150
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
24c150
Acked-by: Jason Wang <jasowang@redhat.com>
24c150
Message-Id: <1651890498-24478-4-git-send-email-si-wei.liu@oracle.com>
24c150
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
24c150
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
24c150
(cherry picked from commit 9bd055073e375c8a0d7ebce925e05d914d69fc7f)
24c150
Signed-off-by: Cindy Lu <lulu@redhat.com>
24c150
---
24c150
 net/vhost-vdpa.c | 4 +++-
24c150
 1 file changed, 3 insertions(+), 1 deletion(-)
24c150
24c150
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
24c150
index 25dd6dd975..814f704687 100644
24c150
--- a/net/vhost-vdpa.c
24c150
+++ b/net/vhost-vdpa.c
24c150
@@ -306,7 +306,9 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
24c150
 
24c150
 err:
24c150
     if (i) {
24c150
-        qemu_del_net_client(ncs[0]);
24c150
+        for (i--; i >= 0; i--) {
24c150
+            qemu_del_net_client(ncs[i]);
24c150
+        }
24c150
     }
24c150
     qemu_close(vdpa_device_fd);
24c150
     g_free(ncs);
24c150
-- 
24c150
2.31.1
24c150