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

Justin M. Forbes d4cdad
From fad276489cbc04f228d52b7019bee9e7a88c8a86 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
Justin M. Forbes d4cdad
Subject: [PATCH 118/118] 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
---
Justin M. Forbes d4cdad
 qemu-char.c |    5 +++++
Justin M. Forbes d4cdad
 1 files changed, 5 insertions(+), 0 deletions(-)
Justin M. Forbes d4cdad
Justin M. Forbes d4cdad
diff --git a/qemu-char.c b/qemu-char.c
Justin M. Forbes d4cdad
index 5f67652..5a94919 100644
Justin M. Forbes d4cdad
--- a/qemu-char.c
Justin M. Forbes d4cdad
+++ b/qemu-char.c
Justin M. Forbes d4cdad
@@ -220,6 +220,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
-- 
Justin M. Forbes d4cdad
1.7.7.5
Justin M. Forbes d4cdad