diff --git a/net/vhost-user.c b/net/vhost-user.c index 014199d6008f380ef0f296655339356b4753a6d3..7eec49d2cefce3ee8f2d5a358e548bbb12158b34 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -227,22 +227,27 @@ static void chr_closed_bh(void *opaque) NetVhostUserState *s; Error *err = NULL; int queues; + int i; queues = qemu_find_net_clients_except(name, ncs, NET_CLIENT_DRIVER_NIC, MAX_QUEUE_NUM); assert(queues < MAX_QUEUE_NUM); - s = DO_UPCAST(NetVhostUserState, nc, ncs[0]); - - if (s->vhost_net) { - s->acked_features = vhost_net_get_acked_features(s->vhost_net); - } + for (i = 0; i < queues; i++) { + s = DO_UPCAST(NetVhostUserState, nc, ncs[i]); + if (s->vhost_net) { + s->acked_features = vhost_net_get_acked_features(s->vhost_net); + } + } qmp_set_link(name, false, &err); - qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event, - NULL, opaque, NULL, true); + for (i = 0; i < queues; i++) { + s = DO_UPCAST(NetVhostUserState, nc, ncs[i]); + qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event, + NULL, opaque, NULL, true); + } if (err) { error_report_err(err);