render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

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

5544c1
From f3551d3640f3436b0e5505fd208cbd7bbfef411f 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
5544c1
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>
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
5544c1
index bfc94a5..67a6d73 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
-- 
5544c1
1.7.12.1
Justin M. Forbes d4cdad