Blame 0113-char-Disable-write-callback-if-throttled-chardev-is-.patch

bd56df
From 34b7ca715ee45925b76fbeb23a24c16015adba33 Mon Sep 17 00:00:00 2001
bd56df
Message-Id: <34b7ca715ee45925b76fbeb23a24c16015adba33.1346162949.git.crobinso@redhat.com>
bd56df
In-Reply-To: <90a59d545ad6759c105b0bfcfca70f574482584f.1346162949.git.crobinso@redhat.com>
bd56df
References: <90a59d545ad6759c105b0bfcfca70f574482584f.1346162949.git.crobinso@redhat.com>
Justin M. Forbes d4cdad
From: Amit Shah <amit.shah@redhat.com>
Justin M. Forbes d4cdad
Date: Fri, 2 Dec 2011 15:42:55 +0530
bd56df
Subject: [PATCH 113/114] char: Disable write callback if throttled chardev is
Justin M. Forbes d4cdad
 detached
Justin M. Forbes d4cdad
Justin M. Forbes d4cdad
If a throttled chardev is detached from the frontend device, all future
Justin M. Forbes d4cdad
callbacks should be suppressed.  Not doing this results in a segfault.
Justin M. Forbes d4cdad
Justin M. Forbes d4cdad
Bugzilla: 745758
Justin M. Forbes d4cdad
Upstream: Not applicable, since throttling is a RHEL6-only feature.
Justin M. Forbes d4cdad
Justin M. Forbes d4cdad
Signed-off-by: Amit Shah <amit.shah@redhat.com>
bd56df
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Justin M. Forbes d4cdad
---
b6dd5a
 qemu-char.c | 5 +++++
Hans de Goede 329b58
 1 file changed, 5 insertions(+)
Justin M. Forbes d4cdad
Justin M. Forbes d4cdad
diff --git a/qemu-char.c b/qemu-char.c
bd56df
index d86ee88..9defbec 100644
Justin M. Forbes d4cdad
--- a/qemu-char.c
Justin M. Forbes d4cdad
+++ b/qemu-char.c
Hans de Goede 329b58
@@ -223,6 +223,11 @@ void qemu_chr_add_handlers(CharDriverState *s,
Justin M. Forbes d4cdad
         ++s->avail_connections;
Justin M. Forbes d4cdad
     }
Justin M. Forbes d4cdad
     if (!handlers) {
Justin M. Forbes d4cdad
+        if (s->write_blocked) {
Justin M. Forbes d4cdad
+            /* Ensure we disable the callback if we were throttled */
Justin M. Forbes d4cdad
+            s->chr_disable_write_fd_handler(s);
Justin M. Forbes d4cdad
+            /* s->write_blocked is cleared below */
Justin M. Forbes d4cdad
+        }
Justin M. Forbes d4cdad
         handlers = &null_handlers;
Justin M. Forbes d4cdad
     }
Justin M. Forbes d4cdad
     s->chr_can_read = handlers->fd_can_read;
Justin M. Forbes d4cdad
-- 
b6dd5a
1.7.11.2
Justin M. Forbes d4cdad