[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] vhost-user: return if no net clients found
From: |
Chen Hanxiao |
Subject: |
[Qemu-devel] [PATCH] vhost-user: return if no net clients found |
Date: |
Thu, 1 Sep 2016 18:13:50 +0800 |
From: Chen Hanxiao <address@hidden>
If we can't find a suitable net client, return directly.
Or we will got a segmentation fault.
Signed-off-by: Chen Hanxiao <address@hidden>
---
net/vhost-user.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/vhost-user.c b/net/vhost-user.c
index b0595f8..fb96db7 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -210,6 +210,9 @@ static void net_vhost_user_event(void *opaque, int event)
MAX_QUEUE_NUM);
assert(queues < MAX_QUEUE_NUM);
+ if (queues < 1)
+ return;
+
s = DO_UPCAST(VhostUserState, nc, ncs[0]);
trace_vhost_user_event(s->chr->label, event);
switch (event) {
--
1.8.3.1
- [Qemu-devel] [PATCH] vhost-user: return if no net clients found,
Chen Hanxiao <=