From: Marc-André Lureau Date: Tue, 23 Feb 2016 18:10:53 +0000 (+0100) Subject: qemu-char: make tcp_chr_disconnect() reentrant-safe X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=342f7a9d056d6863475abf35bd4c06bcf1185462;p=qemu.git qemu-char: make tcp_chr_disconnect() reentrant-safe During CHR_EVENT_CLOSED, the function could be reentered, make this case safe. Signed-off-by: Marc-André Lureau Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/qemu-char.c b/qemu-char.c index 3813efdf19..27fbb440ac 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2769,6 +2769,10 @@ static void tcp_chr_disconnect(CharDriverState *chr) { TCPCharDriver *s = chr->opaque; + if (!s->connected) { + return; + } + s->connected = 0; if (s->listen_ioc) { s->listen_tag = qio_channel_add_watch(