[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 32/38] chardev: fix pty_chr_timer
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 32/38] chardev: fix pty_chr_timer |
Date: |
Wed, 25 Sep 2013 07:58:00 -0500 |
From: Gerd Hoffmann <address@hidden>
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: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
(cherry picked from commit b0d768c35e08d2057b63e8e77e7a513c447199fa)
Signed-off-by: Michael Roth <address@hidden>
---
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;
}
--
1.7.9.5
- [Qemu-stable] [PATCH 22/38] memory: Provide separate handling of unassigned io ports accesses, (continued)
- [Qemu-stable] [PATCH 22/38] memory: Provide separate handling of unassigned io ports accesses, Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 28/38] pc: Initializing ram_memory under Xen., Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 25/38] ne2000: mark I/O as LITTLE_ENDIAN, Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 31/38] pcnet-pci: mark I/O and MMIO as LITTLE_ENDIAN, Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 30/38] qapi-types.py: Fix enum struct sizes on i686, Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 36/38] tci: Fix qemu-alpha on 32 bit hosts (wrong assertions), Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 34/38] kvmvapic: Enter inactive state on hardware reset, Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 29/38] pc_q35: Initialize Xen., Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 33/38] kvmvapic: Catch invalid ROM size, Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 35/38] kvmvapic: Clear also physical ROM address when entering INACTIVE state, Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 32/38] chardev: fix pty_chr_timer,
Michael Roth <=
- [Qemu-stable] [PATCH 38/38] virtio-blk: do not relay a previous driver's WCE configuration to the current, Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 37/38] blockdev: do not default cache.no-flush to true, Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 26/38] ehci: save device pointer in EHCIState, Michael Roth, 2013/09/25
- [Qemu-stable] [PATCH 27/38] qxl: fix local renderer, Michael Roth, 2013/09/25
- Re: [Qemu-stable] Patch Round-up for stable 1.6.1, freeze on 2013-09-30, Cole Robinson, 2013/09/25
- Re: [Qemu-stable] [Qemu-devel] Patch Round-up for stable 1.6.1, freeze on 2013-09-30, Stefan Weil, 2013/09/26
- Re: [Qemu-stable] [Qemu-devel] Patch Round-up for stable 1.6.1, freeze on 2013-09-30, Fam Zheng, 2013/09/26
- Re: [Qemu-stable] [Qemu-devel] Patch Round-up for stable 1.6.1, freeze on 2013-09-30, Stefan Weil, 2013/09/26