diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-02-23 19:10:53 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-03-11 16:59:12 +0200 |
commit | 342f7a9d056d6863475abf35bd4c06bcf1185462 (patch) | |
tree | 364c26b24c436b5475ed2a074bc7a165a9ae2c62 | |
parent | 6167ebbd914229f4ee745576241eaa020cc98239 (diff) |
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 <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r-- | qemu-char.c | 4 |
1 files changed, 4 insertions, 0 deletions
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( |