aboutsummaryrefslogtreecommitdiff
path: root/net/vhost-user.c
diff options
context:
space:
mode:
authorVictor Kaplansky <victork@redhat.com>2015-12-01 15:32:26 +0200
committerMichael S. Tsirkin <mst@redhat.com>2015-12-02 16:42:27 +0200
commit6f6f9512ea915009abeb6a4c5f204d4c25f090e0 (patch)
tree807646fb68602f371287b8d40c95ec8745a0ffd5 /net/vhost-user.c
parent45ce512670f34d10be34448e621fd1484bea0ec6 (diff)
downloadqemu-6f6f9512ea915009abeb6a4c5f204d4c25f090e0.zip
qemu-6f6f9512ea915009abeb6a4c5f204d4c25f090e0.tar.gz
qemu-6f6f9512ea915009abeb6a4c5f204d4c25f090e0.tar.bz2
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>
Diffstat (limited to 'net/vhost-user.c')
-rw-r--r--net/vhost-user.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 5071602..b368a90 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);
}