]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qemu-char: make tcp_chr_disconnect() reentrant-safe
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 23 Feb 2016 18:10:53 +0000 (19:10 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 11 Mar 2016 14:59:12 +0000 (16:59 +0200)
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>
qemu-char.c

index 3813efdf1986da33d45c65f60d5d8064e622fe55..27fbb440acae99ba7d9ce3dda980500766050515 100644 (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(