From 6f6f9512ea915009abeb6a4c5f204d4c25f090e0 Mon Sep 17 00:00:00 2001 From: Victor Kaplansky Date: Tue, 1 Dec 2015 15:32:26 +0200 Subject: [PATCH] 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang --- net/vhost-user.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/vhost-user.c b/net/vhost-user.c index 5071602e9b..b368a90219 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -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); } -- 2.11.4.GIT