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: Victor Kaplansky <victork@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
Victor Kaplansky 2015-12-01 15:32:26 +02:00 committed by Michael S. Tsirkin
parent 45ce512670
commit 6f6f9512ea
1 changed files with 5 additions and 0 deletions

View File

@ -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);
}