]> git.ipfire.org Git - thirdparty/qemu.git/commit
ui: avoid crash if vnc client disconnects with writes pending
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 27 Jun 2016 15:48:49 +0000 (16:48 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 28 Sep 2016 15:44:14 +0000 (10:44 -0500)
commit2b13613e02e145440f86e05124d574fd2c2afa0a
tree7c0fe780966f5420a98ea249605613da31c71f55
parent6e184753b3c1ba10e4b552805cb00ec8c51560b0
ui: avoid crash if vnc client disconnects with writes pending

The vnc_client_read() function is called from the vnc_client_io()
event handler callback when there is incoming data to process.
If it detects that the client has disconnected, then it will
trigger cleanup and free'ing of the VncState client struct at
a safe time.

Unfortunately, the vnc_client_io() event handler will also call
vnc_client_write() to handle any outgoing data writes. So if
vnc_client_io() was invoked with both G_IO_IN and G_IO_OUT
events set, and the client disconnects, we may try to write to
a client which has just been freed.

https://bugs.launchpad.net/qemu/+bug/1594861

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 1467042529-3372-1-git-send-email-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit ea697449884d83b83fefbc9cd87bdde0c94b49d6)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
ui/vnc.c