Blame SOURCES/kvm-vhost-net-fix-improper-cleanup-in-vhost_net_start.patch

24c150
From 1e3faef7048c8d36c9e3f004c7e08d96b30d055f 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:15 -0700
24c150
Subject: [PATCH 4/7] vhost-net: fix improper cleanup in vhost_net_start
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: [4/7] 31575b626fd5b381a4640e4f2608033bb141dc62
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
vhost_net_start() missed a corresponding stop_one() upon error from
24c150
vhost_set_vring_enable(). While at it, make the error handling for
24c150
err_start more robust. No real issue was found due to this though.
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-5-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 6f3910b5eee00b8cc959e94659c0d524c482a418)
24c150
Signed-off-by: Cindy Lu <lulu@redhat.com>
24c150
---
24c150
 hw/net/vhost_net.c | 4 +++-
24c150
 1 file changed, 3 insertions(+), 1 deletion(-)
24c150
24c150
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
24c150
index 30379d2ca4..d6d7c51f62 100644
24c150
--- a/hw/net/vhost_net.c
24c150
+++ b/hw/net/vhost_net.c
24c150
@@ -381,6 +381,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
24c150
             r = vhost_set_vring_enable(peer, peer->vring_enable);
24c150
 
24c150
             if (r < 0) {
24c150
+                vhost_net_stop_one(get_vhost_net(peer), dev);
24c150
                 goto err_start;
24c150
             }
24c150
         }
24c150
@@ -390,7 +391,8 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
24c150
 
24c150
 err_start:
24c150
     while (--i >= 0) {
24c150
-        peer = qemu_get_peer(ncs , i);
24c150
+        peer = qemu_get_peer(ncs, i < data_queue_pairs ?
24c150
+                                  i : n->max_queue_pairs);
24c150
         vhost_net_stop_one(get_vhost_net(peer), dev);
24c150
     }
24c150
     e = k->set_guest_notifiers(qbus->parent, total_notifiers, false);
24c150
-- 
24c150
2.31.1
24c150