thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

586cba
From 3142102adb98f46518c0ac1773b0c48710c6bed6 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
586cba
Subject: [PATCH 10/16] 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
586cba
RH-Author: Jason Wang <jasowang@redhat.com>
586cba
RH-MergeRequest: 98: Multiqueue fixes for vhost-vDPA
586cba
RH-Commit: [3/7] c83ff6c97d34cfae3c3447edde934b42a9ace75f (jasowang/qemu-kvm-cs)
586cba
RH-Bugzilla: 2070804
24c150
RH-Acked-by: Eugenio PĂ©rez <eperezma@redhat.com>
586cba
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
586cba
RH-Acked-by: Cindy Lu <lulu@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)
586cba
Signed-off-by: Jason Wang <jasowang@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
586cba
index 1e9fe47c03..df1e69ee72 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);
586cba
 
24c150
-- 
24c150
2.31.1
24c150