From: Pavel Grunt <pgrunt@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] spice-qemu-char: do not use port device when it is not active
Date: Wed, 23 Sep 2015 17:24:23 +0200 [thread overview]
Message-ID: <1443021863-20752-1-git-send-email-pgrunt@redhat.com> (raw)
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 <pgrunt@redhat.com>
---
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(+)
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index d41bb74..840c181 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -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
}
--
2.5.0
reply other threads:[~2015-09-23 15:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443021863-20752-1-git-send-email-pgrunt@redhat.com \
--to=pgrunt@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).