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

719b13
From 2206114457f3c575b2cf148ff643f78d5e67e8d2 Mon Sep 17 00:00:00 2001
719b13
From: Si-Wei Liu <si-wei.liu@oracle.com>
719b13
Date: Fri, 6 May 2022 19:28:15 -0700
719b13
Subject: [PATCH 4/7] vhost-net: fix improper cleanup in vhost_net_start
719b13
MIME-Version: 1.0
719b13
Content-Type: text/plain; charset=UTF-8
719b13
Content-Transfer-Encoding: 8bit
719b13
719b13
RH-Author: Cindy Lu <lulu@redhat.com>
719b13
RH-MergeRequest: 203: vdpa :sync the Multiqueue fixes for vhost-vDPA
719b13
RH-Commit: [4/7] b09e0785b6e1c46da3ff59a8e4f4dea7d86e4f0b
719b13
RH-Bugzilla: 2095794
719b13
RH-Acked-by: MST <mst@redhat.com>
719b13
RH-Acked-by: Eugenio PĂ©rez <eperezma@redhat.com>
719b13
RH-Acked-by: Jason Wang <jasowang@redhat.com>
719b13
719b13
vhost_net_start() missed a corresponding stop_one() upon error from
719b13
vhost_set_vring_enable(). While at it, make the error handling for
719b13
err_start more robust. No real issue was found due to this though.
719b13
719b13
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
719b13
Acked-by: Jason Wang <jasowang@redhat.com>
719b13
Message-Id: <1651890498-24478-5-git-send-email-si-wei.liu@oracle.com>
719b13
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
719b13
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
719b13
(cherry picked from commit 6f3910b5eee00b8cc959e94659c0d524c482a418)
719b13
Signed-off-by: Cindy Lu <lulu@redhat.com>
719b13
---
719b13
 hw/net/vhost_net.c | 4 +++-
719b13
 1 file changed, 3 insertions(+), 1 deletion(-)
719b13
719b13
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
719b13
index 30379d2ca4..d6d7c51f62 100644
719b13
--- a/hw/net/vhost_net.c
719b13
+++ b/hw/net/vhost_net.c
719b13
@@ -381,6 +381,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
719b13
             r = vhost_set_vring_enable(peer, peer->vring_enable);
719b13
 
719b13
             if (r < 0) {
719b13
+                vhost_net_stop_one(get_vhost_net(peer), dev);
719b13
                 goto err_start;
719b13
             }
719b13
         }
719b13
@@ -390,7 +391,8 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
719b13
 
719b13
 err_start:
719b13
     while (--i >= 0) {
719b13
-        peer = qemu_get_peer(ncs , i);
719b13
+        peer = qemu_get_peer(ncs, i < data_queue_pairs ?
719b13
+                                  i : n->max_queue_pairs);
719b13
         vhost_net_stop_one(get_vhost_net(peer), dev);
719b13
     }
719b13
     e = k->set_guest_notifiers(qbus->parent, total_notifiers, false);
719b13
-- 
719b13
2.31.1
719b13