diff options
author | Ilya Maximets <i.maximets@samsung.com> | 2016-02-24 13:44:34 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-03-11 14:55:15 +0200 |
commit | fff4e48ed54cc39e5942921df91300646ad37707 (patch) | |
tree | dbfe119c107fac30f6160e1d211b860d48d733e1 /net/vhost-user.c | |
parent | a0d06486b445985b8d128df172daefbae205bffd (diff) | |
download | qemu-fff4e48ed54cc39e5942921df91300646ad37707.tar.gz qemu-fff4e48ed54cc39e5942921df91300646ad37707.tar.bz2 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/vhost-user.c')
-rw-r--r-- | net/vhost-user.c | 5 |
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; } |