[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 4/6] vhost-net: fix improper cleanup in vhost_net_start
From: |
Si-Wei Liu |
Subject: |
[PATCH v3 4/6] vhost-net: fix improper cleanup in vhost_net_start |
Date: |
Thu, 5 May 2022 21:54:32 -0700 |
vhost_net_start() missed a corresponding stop_one() upon error from
vhost_set_vring_enable(). While at it, make the error handling for
err_start more robust. No real issue was found due to this though.
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
Acked-by: Jason Wang <jasowang@redhat.com>
---
hw/net/vhost_net.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 30379d2..d6d7c51 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -381,6 +381,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
r = vhost_set_vring_enable(peer, peer->vring_enable);
if (r < 0) {
+ vhost_net_stop_one(get_vhost_net(peer), dev);
goto err_start;
}
}
@@ -390,7 +391,8 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
err_start:
while (--i >= 0) {
- peer = qemu_get_peer(ncs , i);
+ peer = qemu_get_peer(ncs, i < data_queue_pairs ?
+ i : n->max_queue_pairs);
vhost_net_stop_one(get_vhost_net(peer), dev);
}
e = k->set_guest_notifiers(qbus->parent, total_notifiers, false);
--
1.8.3.1
- [PATCH v3 0/6] vhost-vdpa multiqueue fixes, Si-Wei Liu, 2022/05/06
- [PATCH v3 5/6] vhost-vdpa: backend feature should set only once, Si-Wei Liu, 2022/05/06
- [PATCH v3 2/6] virtio-net: align ctrl_vq index for non-mq guest for vhost_vdpa, Si-Wei Liu, 2022/05/06
- [PATCH v3 1/6] virtio-net: setup vhost_dev and notifiers for cvq only when feature is negotiated, Si-Wei Liu, 2022/05/06
- [PATCH v3 4/6] vhost-net: fix improper cleanup in vhost_net_start,
Si-Wei Liu <=
- [PATCH v3 6/6] virtio-net: don't handle mq request in userspace handler for vhost-vdpa, Si-Wei Liu, 2022/05/06
- [PATCH v3 3/6] vhost-vdpa: fix improper cleanup in net_init_vhost_vdpa, Si-Wei Liu, 2022/05/06