2983660f65
CVE-2013-4377: Fix crash when unplugging virtio devices (bz #1012633, bz #1012641) Fix 'new snapshot' slowness after the first snap (bz #988436) Fix 9pfs xattrs on kernel 3.11 (bz #1013676) CVE-2013-4344: buffer overflow in scsi_target_emulate_report_luns (bz #1015274, bz #1007330)
53 lines
1.5 KiB
Diff
53 lines
1.5 KiB
Diff
From 4b5b4721464495fe76fe6e2e033cbb61dce78eef Mon Sep 17 00:00:00 2001
|
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
Date: Thu, 22 Aug 2013 11:43:58 +0200
|
|
Subject: [PATCH] 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 | 12 ++++--------
|
|
1 file changed, 4 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/qemu-char.c b/qemu-char.c
|
|
index 1be1cf6..1621fbd 100644
|
|
--- a/qemu-char.c
|
|
+++ b/qemu-char.c
|
|
@@ -1026,15 +1026,11 @@ static gboolean pty_chr_timer(gpointer opaque)
|
|
struct CharDriverState *chr = opaque;
|
|
PtyCharDriver *s = chr->opaque;
|
|
|
|
- if (s->connected) {
|
|
- goto out;
|
|
- }
|
|
-
|
|
- /* Next poll ... */
|
|
- pty_chr_update_read_handler(chr);
|
|
-
|
|
-out:
|
|
s->timer_tag = 0;
|
|
+ if (!s->connected) {
|
|
+ /* Next poll ... */
|
|
+ pty_chr_update_read_handler(chr);
|
|
+ }
|
|
return FALSE;
|
|
}
|
|
|