]> git.ipfire.org Git - thirdparty/qemu.git/commit
chardev: fix pty_chr_timer
authorGerd Hoffmann <kraxel@redhat.com>
Thu, 22 Aug 2013 09:43:58 +0000 (11:43 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 25 Sep 2013 03:52:23 +0000 (22:52 -0500)
commit4b5b4721464495fe76fe6e2e033cbb61dce78eef
treeb29a79bc87d28c138314865a78ed381c4a5aaf51
parent76f698948781a148d336ff9032159f6c7c9eccd2
chardev: fix pty_chr_timer

pty_chr_timer first calls pty_chr_update_read_handler(), then clears
timer_tag (because it is a one-shot timer).   This is the wrong order
though.  pty_chr_update_read_handler might re-arm time timer, and the
new timer_tag gets overwitten in that case.

This leads to crashes when unplugging a pty chardev:  pty_chr_close
thinks no timer is running -> timer isn't canceled -> pty_chr_timer gets
called with stale CharDevState -> BOOM.

This patch fixes the ordering.
Kill the pointless goto while being at it.

https://bugzilla.redhat.com/show_bug.cgi?id=994414

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit b0d768c35e08d2057b63e8e77e7a513c447199fa)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qemu-char.c