|
|
9ae3a8 |
From 65b9fb19d5853b28b6748963d9e0053429655921 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 18 Sep 2013 09:53:54 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 01/18] chardev: fix pty_chr_timer
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1379498034-29529-2-git-send-email-kraxel@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 54429
|
|
|
9ae3a8 |
O-Subject: [RHEL-7 qemu-kvm PATCH 1/1] chardev: fix pty_chr_timer
|
|
|
9ae3a8 |
Bugzilla: 994414
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
pty_chr_timer first calls pty_chr_update_read_handler(), then clears
|
|
|
9ae3a8 |
timer_tag (because it is a one-shot timer). This is the wrong order
|
|
|
9ae3a8 |
though. pty_chr_update_read_handler might re-arm time timer, and the
|
|
|
9ae3a8 |
new timer_tag gets overwitten in that case.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This leads to crashes when unplugging a pty chardev: pty_chr_close
|
|
|
9ae3a8 |
thinks no timer is running -> timer isn't canceled -> pty_chr_timer gets
|
|
|
9ae3a8 |
called with stale CharDevState -> BOOM.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This patch fixes the ordering.
|
|
|
9ae3a8 |
Kill the pointless goto while being at it.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
https://bugzilla.redhat.com/show_bug.cgi?id=994414
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Cc: qemu-stable@nongnu.org
|
|
|
9ae3a8 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit b0d768c35e08d2057b63e8e77e7a513c447199fa)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
qemu-char.c | 12 ++++--------
|
|
|
9ae3a8 |
1 file changed, 4 insertions(+), 8 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
qemu-char.c | 12 ++++--------
|
|
|
9ae3a8 |
1 files changed, 4 insertions(+), 8 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/qemu-char.c b/qemu-char.c
|
|
|
9ae3a8 |
index 2fb876c..660d758 100644
|
|
|
9ae3a8 |
--- a/qemu-char.c
|
|
|
9ae3a8 |
+++ b/qemu-char.c
|
|
|
9ae3a8 |
@@ -1029,15 +1029,11 @@ static gboolean pty_chr_timer(gpointer opaque)
|
|
|
9ae3a8 |
struct CharDriverState *chr = opaque;
|
|
|
9ae3a8 |
PtyCharDriver *s = chr->opaque;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (s->connected) {
|
|
|
9ae3a8 |
- goto out;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- /* Next poll ... */
|
|
|
9ae3a8 |
- pty_chr_update_read_handler(chr);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
-out:
|
|
|
9ae3a8 |
s->timer_tag = 0;
|
|
|
9ae3a8 |
+ if (!s->connected) {
|
|
|
9ae3a8 |
+ /* Next poll ... */
|
|
|
9ae3a8 |
+ pty_chr_update_read_handler(chr);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
return FALSE;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|