qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 4/9] vhost-user: verify that number of queues is non-


From: Michael S. Tsirkin
Subject: [Qemu-devel] [PULL 4/9] vhost-user: verify that number of queues is non-zero
Date: Wed, 2 Dec 2015 22:35:32 +0200

From: Victor Kaplansky <address@hidden>

Fix QEMU crash when -netdev type=vhost-user,queues=n is passed
with zero number of queues.

Signed-off-by: Victor Kaplansky <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Acked-by: Jason Wang <address@hidden>
---
 net/vhost-user.c | 5 +++++
 1 file changed, 5 insertions(+)

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);
 }
-- 
MST




reply via email to

[Prev in Thread] Current Thread [Next in Thread]