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

22d63f
From 736b3ad749e5c60de44d4c5836b59d2287b6b918 Mon Sep 17 00:00:00 2001
22d63f
Message-Id: <736b3ad749e5c60de44d4c5836b59d2287b6b918.1354903384.git.crobinso@redhat.com>
22d63f
In-Reply-To: <9f0944a25bc1094fa7a74ac9df14e184e2c5c82d.1354903384.git.crobinso@redhat.com>
22d63f
References: <9f0944a25bc1094fa7a74ac9df14e184e2c5c82d.1354903384.git.crobinso@redhat.com>
22d63f
From: Amit Shah <amit.shah@redhat.com>
22d63f
Date: Fri, 2 Dec 2011 15:42:55 +0530
22d63f
Subject: [PATCH] char: Disable write callback if throttled chardev is
22d63f
 detached
22d63f
22d63f
If a throttled chardev is detached from the frontend device, all future
22d63f
callbacks should be suppressed.  Not doing this results in a segfault.
22d63f
22d63f
Bugzilla: 745758
22d63f
Upstream: Not applicable, since throttling is a RHEL6-only feature.
22d63f
22d63f
Signed-off-by: Amit Shah <amit.shah@redhat.com>
22d63f
Signed-off-by: Cole Robinson <crobinso@redhat.com>
22d63f
---
22d63f
 qemu-char.c | 5 +++++
22d63f
 1 file changed, 5 insertions(+)
22d63f
22d63f
diff --git a/qemu-char.c b/qemu-char.c
22d63f
index 5c71f0c..16ad6b6 100644
22d63f
--- a/qemu-char.c
22d63f
+++ b/qemu-char.c
22d63f
@@ -224,6 +224,11 @@ void qemu_chr_add_handlers(CharDriverState *s,
22d63f
         ++s->avail_connections;
22d63f
     }
22d63f
     if (!handlers) {
22d63f
+        if (s->write_blocked) {
22d63f
+            /* Ensure we disable the callback if we were throttled */
22d63f
+            s->chr_disable_write_fd_handler(s);
22d63f
+            /* s->write_blocked is cleared below */
22d63f
+        }
22d63f
         handlers = &null_handlers;
22d63f
     }
22d63f
     s->chr_can_read = handlers->fd_can_read;
22d63f
-- 
22d63f
1.8.0
22d63f