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>
This commit is contained in:
Marc-André Lureau 2016-02-23 19:10:53 +01:00 committed by Michael S. Tsirkin
parent 6167ebbd91
commit 342f7a9d05

View File

@ -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(