summaryrefslogtreecommitdiffstats
path: root/net/vhost-user.c
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@samsung.com>2016-02-24 13:44:34 +0300
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:49:36 -0600
commitb19df935f0a059bff37505ff0f86e9c1d52abfd0 (patch)
treea3f47c8b72028912ec88347fec51db6cf8ecf73b /net/vhost-user.c
parentf0d7b7b95ddf5a0ad8569fc7fa557fc1a17afbde (diff)
downloadhqemu-b19df935f0a059bff37505ff0f86e9c1d52abfd0.zip
hqemu-b19df935f0a059bff37505ff0f86e9c1d52abfd0.tar.gz
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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 451dbbf..b753b3d 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;
}
OpenPOWER on IntegriCloud