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

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