dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

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

Hans de Goede 329b58
From 303a46e3877f6d9600151fdf9719fdb2009db7ff 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
Hans de Goede 329b58
Subject: [PATCH 113/114] 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 +++++
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
Hans de Goede 329b58
index c263328..622c388 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
-- 
Hans de Goede 329b58
1.7.10.4
Justin M. Forbes d4cdad