From: Tim Hardeck <thardeck@suse.de>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, stefanha@gmail.com, github@martintribe.org,
Tim Hardeck <thardeck@suse.de>,
alevy@redhat.com, kraxel@redhat.com, corentin.chary@gmail.com
Subject: [Qemu-devel] [PATCH 3/3] vnc: fix possible uninitialized removals
Date: Fri, 7 Dec 2012 15:56:35 +0100 [thread overview]
Message-ID: <1354892195-18332-4-git-send-email-thardeck@suse.de> (raw)
In-Reply-To: <1354892195-18332-1-git-send-email-thardeck@suse.de>
Some VncState values are not initialized before the Websocket handshake.
If it fails QEMU segfaults during the cleanup. To prevent this behavior
intialization checks are added.
Signed-off-by: Tim Hardeck <thardeck@suse.de>
---
ui/vnc.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index a5c16e0..3af1840 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1053,20 +1053,26 @@ void vnc_disconnect_finish(VncState *vs)
audio_del(vs);
vnc_release_modifiers(vs);
- QTAILQ_REMOVE(&vs->vd->clients, vs, next);
+ if (!QTAILQ_EMPTY(&vs->vd->clients)) {
+ QTAILQ_REMOVE(&vs->vd->clients, vs, next);
+ }
if (QTAILQ_EMPTY(&vs->vd->clients)) {
dcl->idle = 1;
}
- qemu_remove_mouse_mode_change_notifier(&vs->mouse_mode_notifier);
+ if (vs->mouse_mode_notifier.notify != NULL) {
+ qemu_remove_mouse_mode_change_notifier(&vs->mouse_mode_notifier);
+ }
vnc_remove_timer(vs->vd);
if (vs->vd->lock_key_sync)
qemu_remove_led_event_handler(vs->led);
vnc_unlock_output(vs);
qemu_mutex_destroy(&vs->output_mutex);
- qemu_bh_delete(vs->bh);
+ if (vs->bh != NULL) {
+ qemu_bh_delete(vs->bh);
+ }
buffer_free(&vs->jobs_buffer);
for (i = 0; i < VNC_STAT_ROWS; ++i) {
--
1.7.10.4
next prev parent reply other threads:[~2012-12-07 14:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-07 14:56 [Qemu-devel] [PATCH 0/3 v4] vnc: added initial websocket protocol support Tim Hardeck
2012-12-07 14:56 ` [Qemu-devel] [PATCH 1/3] vnc: added buffer_advance function Tim Hardeck
2012-12-07 14:56 ` [Qemu-devel] [PATCH 2/3 v4] vnc: added initial websocket protocol support Tim Hardeck
2012-12-11 10:04 ` Stefan Hajnoczi
2012-12-12 10:04 ` Tim Hardeck
2012-12-12 13:30 ` Stefan Hajnoczi
2012-12-07 14:56 ` Tim Hardeck [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-01-02 13:29 [Qemu-devel] [PATCH 0/3 v5] " Tim Hardeck
2013-01-02 13:29 ` [Qemu-devel] [PATCH 3/3] vnc: fix possible uninitialized removals Tim Hardeck
2013-01-08 10:27 [Qemu-devel] [PATCH 0/3 v6] vnc: added initial websocket protocol support Tim Hardeck
2013-01-08 10:27 ` [Qemu-devel] [PATCH 3/3] vnc: fix possible uninitialized removals Tim Hardeck
2013-01-21 10:04 [Qemu-devel] [PATCH 0/3 v7] vnc: added initial websocket protocol support Tim Hardeck
2013-01-21 10:04 ` [Qemu-devel] [PATCH 3/3] vnc: fix possible uninitialized removals Tim Hardeck
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=1354892195-18332-4-git-send-email-thardeck@suse.de \
--to=thardeck@suse.de \
--cc=alevy@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=corentin.chary@gmail.com \
--cc=github@martintribe.org \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/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).