thebeanogamer / rpms / qemu-kvm

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