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

b6dd5a
From 131729b07be897a363d8d769ecc056dabe2ed7da Mon Sep 17 00:00:00 2001
Justin M. Forbes d4cdad
From: Amit Shah <amit.shah@redhat.com>
Justin M. Forbes d4cdad
Date: Fri, 2 Dec 2011 15:42:55 +0530
b6dd5a
Subject: [PATCH] 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>
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
b6dd5a
index caa2efb..7f24878 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