Message ID | 1648621997-22416-7-git-send-email-si-wei.liu@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | vhost-vdpa multiqueue fixes | expand |
On Wed, Mar 30, 2022 at 2:33 PM Si-Wei Liu <si-wei.liu@oracle.com> wrote: > > 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 >
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);
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> --- hw/net/vhost_net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)