1 From f3551d3640f3436b0e5505fd208cbd7bbfef411f Mon Sep 17 00:00:00 2001
2 From: Amit Shah <amit.shah@redhat.com>
3 Date: Fri, 2 Dec 2011 15:42:55 +0530
4 Subject: [PATCH] char: Disable write callback if throttled chardev is
7 If a throttled chardev is detached from the frontend device, all future
8 callbacks should be suppressed. Not doing this results in a segfault.
11 Upstream: Not applicable, since throttling is a RHEL6-only feature.
13 Signed-off-by: Amit Shah <amit.shah@redhat.com>
14 Signed-off-by: Cole Robinson <crobinso@redhat.com>
17 1 file changed, 5 insertions(+)
19 diff --git a/qemu-char.c b/qemu-char.c
20 index bfc94a5..67a6d73 100644
23 @@ -223,6 +223,11 @@ void qemu_chr_add_handlers(CharDriverState *s,
24 ++s->avail_connections;
27 + if (s->write_blocked) {
28 + /* Ensure we disable the callback if we were throttled */
29 + s->chr_disable_write_fd_handler(s);
30 + /* s->write_blocked is cleared below */
32 handlers = &null_handlers;
34 s->chr_can_read = handlers->fd_can_read;