dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

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

6986e1
From 824da34c4d46c0e7707198dc0c4714a5ab775251 Mon Sep 17 00:00:00 2001
22d63f
From: Amit Shah <amit.shah@redhat.com>
22d63f
Date: Fri, 2 Dec 2011 15:42:55 +0530
6986e1
Subject: [PATCH] char: Disable write callback if throttled chardev is 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
-- 
6986e1
1.8.1
22d63f