summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2011-12-02 15:42:55 +0530
committerHans de Goede <hdegoede@redhat.com>2011-12-08 16:10:58 +0100
commit63fd54865255be69254685dcf756b0979fc954db (patch)
tree604dbe0776006acb2705c8545e470a8785c78c6d
parent790305a701d8a3016f4ddecf7c144c2597ef7b00 (diff)
char: Disable write callback if throttled chardev is detachedqemu-1.0-usbredir
If a throttled chardev is detached from the frontend device, all future callbacks should be suppressed. Not doing this results in a segfault. Bugzilla: 745758 Upstream: Not applicable, since throttling is a RHEL6-only feature. Signed-off-by: Amit Shah <amit.shah@redhat.com>
-rw-r--r--qemu-char.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 5f67652f9..5a9491953 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -220,6 +220,11 @@ void qemu_chr_add_handlers(CharDriverState *s,
++s->avail_connections;
}
if (!handlers) {
+ if (s->write_blocked) {
+ /* Ensure we disable the callback if we were throttled */
+ s->chr_disable_write_fd_handler(s);
+ /* s->write_blocked is cleared below */
+ }
handlers = &null_handlers;
}
s->chr_can_read = handlers->fd_can_read;