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

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