[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/10] vhost-user: fix watcher need be removed when v
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 08/10] vhost-user: fix watcher need be removed when vhost-user hotplug |
Date: |
Wed, 2 Aug 2017 00:37:54 +0300 |
From: Yunjian Wang <address@hidden>
"nc" is freed after hotplug vhost-user, but the watcher is not removed.
The QEMU crash when the watcher access the "nc" when socket disconnects.
Program received signal SIGSEGV, Segmentation fault.
#0 object_get_class (address@hidden) at qom/object.c:750
#1 0x00007f9bb4180da1 in qemu_chr_fe_disconnect (be=<optimized out>) at
chardev/char-fe.c:372
#2 0x00007f9bb40d1100 in net_vhost_user_watch (chan=<optimized out>,
cond=<optimized out>, opaque=<optimized out>) at net/vhost-user.c:188
#3 0x00007f9baf97f99a in g_main_context_dispatch () from
/usr/lib64/libglib-2.0.so.0
#4 0x00007f9bb41d7ebc in glib_pollfds_poll () at util/main-loop.c:213
#5 os_host_main_loop_wait (timeout=<optimized out>) at util/main-loop.c:261
#6 main_loop_wait (address@hidden) at util/main-loop.c:515
#7 0x00007f9bb3e266a7 in main_loop () at vl.c:1917
#8 main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>)
at vl.c:4786
Signed-off-by: Yunjian Wang <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
net/vhost-user.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 36f32a2..c23927c 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -151,6 +151,10 @@ static void vhost_user_cleanup(NetClientState *nc)
s->vhost_net = NULL;
}
if (nc->queue_index == 0) {
+ if (s->watch) {
+ g_source_remove(s->watch);
+ s->watch = 0;
+ }
qemu_chr_fe_deinit(&s->chr, true);
}
--
MST
- [Qemu-devel] [PULL 00/10] pc, acpi, virtio: fixes, test speedup for rc1, Michael S. Tsirkin, 2017/08/01
- [Qemu-devel] [PULL 01/10] tests: switch pxe and vm gen id tests to use kvm, Michael S. Tsirkin, 2017/08/01
- [Qemu-devel] [PULL 02/10] vhost: fix a memory leak, Michael S. Tsirkin, 2017/08/01
- [Qemu-devel] [PULL 03/10] vhost-user: fix legacy cross-endian configurations, Michael S. Tsirkin, 2017/08/01
- [Qemu-devel] [PULL 05/10] intel_iommu: use access_flags for iotlb, Michael S. Tsirkin, 2017/08/01
- [Qemu-devel] [PULL 04/10] intel_iommu: fix iova for pt, Michael S. Tsirkin, 2017/08/01
- [Qemu-devel] [PULL 06/10] accel: cleanup error output, Michael S. Tsirkin, 2017/08/01
- [Qemu-devel] [PULL 07/10] tests/bios-tables-test: Compiler warning fix, Michael S. Tsirkin, 2017/08/01
- [Qemu-devel] [PULL 08/10] vhost-user: fix watcher need be removed when vhost-user hotplug,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 09/10] pc: make 'pc.rom' readonly when machine has PCI enabled, Michael S. Tsirkin, 2017/08/01
- [Qemu-devel] [PULL 10/10] pc: acpi: force FADT rev1 for 440fx based machine types, Michael S. Tsirkin, 2017/08/01
- Re: [Qemu-devel] [PULL 00/10] pc, acpi, virtio: fixes, test speedup for rc1, Peter Maydell, 2017/08/02