Commit 6f6f9512 authored by Victor Kaplansky's avatar Victor Kaplansky Committed by Michael S. Tsirkin
Browse files

vhost-user: verify that number of queues is non-zero



Fix QEMU crash when -netdev type=vhost-user,queues=n is passed
with zero number of queues.

Signed-off-by: default avatarVictor Kaplansky <victork@redhat.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
parent 45ce5126
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -316,6 +316,11 @@ int net_init_vhost_user(const NetClientOptions *opts, const char *name,
    }

    queues = vhost_user_opts->has_queues ? vhost_user_opts->queues : 1;
    if (queues < 1) {
        error_setg(errp,
                   "vhost-user number of queues must be bigger than zero");
        return -1;
    }

    return net_vhost_user_init(peer, "vhost_user", name, chr, queues);
}