thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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