summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorIlya Maximets2016-02-24 11:44:34 +0100
committerMichael S. Tsirkin2016-03-11 13:55:15 +0100
commitfff4e48ed54cc39e5942921df91300646ad37707 (patch)
treedbfe119c107fac30f6160e1d211b860d48d733e1 /net
parentvirtio-balloon: add 'available' counter (diff)
downloadqemu-fff4e48ed54cc39e5942921df91300646ad37707.tar.gz
qemu-fff4e48ed54cc39e5942921df91300646ad37707.tar.xz
qemu-fff4e48ed54cc39e5942921df91300646ad37707.zip
vhost-user: verify that number of queues is less than MAX_QUEUE_NUM
Fix QEMU crash when -netdev vhost-user,queues=n is passed with number of queues greater than MAX_QUEUE_NUM. Signed-off-by: Ilya Maximets <i.maximets@samsung.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')
-rw-r--r--net/vhost-user.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 451dbbfb27..b753b3d800 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -317,9 +317,10 @@ 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) {
+ if (queues < 1 || queues > MAX_QUEUE_NUM) {
error_setg(errp,
- "vhost-user number of queues must be bigger than zero");
+ "vhost-user number of queues must be in range [1, %d]",
+ MAX_QUEUE_NUM);
return -1;
}