spice-qemu-char: do not use port device when it is not active
PATCH 1/1 spice-qemu-char: do not use port device when it is not active
Avoid segmentation fault when the webdav channel (spice port channel) is used with the vnc display:
#0 0x00007ffff7ab2594 in spice_char_device_state_opaque_get (dev=0x0) at char_device.c:700 #1 0x00007ffff7b0def3 in spice_server_port_event (sin=<optimized out>, event=<optimized out>) at spicevmc.c:572 #2 0x0000555555781564 in set_guest_connected (port=<optimized out>, guest_connected=1) at hw/char/virtio-console.c:89 #3 0x000055555567273c in control_out (len=<optimized out>, buf=0x5555563b3cf0, vser=0x555557906370) at /home/pgrunt/RH/qemu/hw/char/virtio-serial-bus.c:404 #4 0x000055555567273c in control_out (vdev=0x555557906370, vq=0x5555579769f0) at /home/pgrunt/RH/qemu/hw/char/virtio-serial-bus.c:441 #5 0x0000555555883678 in aio_dispatch (ctx=0x5555562d9db0) at aio-posix.c:156 #6 0x0000555555876f5e in aio_ctx_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at async.c:226 #7 0x00007ffff618ff0a in g_main_context_dispatch (context=0x5555562dae00) at gmain.c:3154 #8 0x00007ffff618ff0a in g_main_context_dispatch (context=context@entry=0x5555562dae00) at gmain.c:3769 #9 0x00005555558823fb in main_loop_wait () at main-loop.c:211
#10 0x00005555558823fb in main_loop_wait (timeout=<optimized out>) at main-loop.c:256
#11 0x00005555558823fb in main_loop_wait (nonblocking=<optimized out>) at main-loop.c:504 #12 0x000055555561514c in main () at vl.c:1879
#13 0x000055555561514c in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4633
Signed-off-by Pavel Grunt <[email protected]>
---
I just changed the display of a VM from Spice to VNC in virt-manager, started the VM and the crash occurred. The VM is the latest Fedora with spice-webdavd installed.
--- spice-qemu-char.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
spice-qemu-char.c +12 -0
@@ -229,6 +229,12 @@ static void spice_port_set_fe_open(struct CharDriverState *chr, int fe_open)#if SPICE_SERVER_VERSION >=0x000c02 SpiceCharDriver *s = chr->opaque; +if (!s->active) { +fprintf (stderr,"spice-qemu-char: port '%s' is not active\n" , + s->sin.portname); +return ; + } +if (fe_open) {spice_server_port_event (&s->sin,SPICE_PORT_EVENT_OPENED ); }else {
@@ -242,6 +248,12 @@ static void spice_chr_fe_event(struct CharDriverState *chr, int event)#if SPICE_SERVER_VERSION >=0x000c02 SpiceCharDriver *s = chr->opaque; +if (!s->active) { +fprintf (stderr,"spice-qemu-char: port '%s' is not active\n" , + s->sin.portname); +return ; + } +spice_server_port_event (&s->sin, event);#endif }
Signature · 1 line
2.5.0