]> git.proxmox.com Git - mirror_qemu.git/commitdiff
char: fix missing return in error path for chardev TLS init
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 30 Sep 2016 15:02:01 +0000 (16:02 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Sat, 8 Oct 2016 08:25:29 +0000 (11:25 +0300)
If the qio_channel_tls_new_(server|client) methods fail,
we disconnect the client. Unfortunately a missing return
means we then go on to try and run the TLS handshake on
a NULL I/O channel. This gives predictably segfaulty
results.

The main way to trigger this is to request a bogus TLS
priority string for the TLS credentials. e.g.

  -object tls-creds-x509,id=tls0,priority=wibble,...

Most other ways appear impossible to trigger except
perhaps if OOM conditions cause gnutls initialization
to fail.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
qemu-char.c

index fb456cec345b10b12a051d44067cce29cb1bdf44..48a45ef583880c7bc09b1c0bbe96f0f0ef2070b0 100644 (file)
@@ -3132,6 +3132,7 @@ static void tcp_chr_tls_init(CharDriverState *chr)
     if (tioc == NULL) {
         error_free(err);
         tcp_chr_disconnect(chr);
+        return;
     }
     object_unref(OBJECT(s->ioc));
     s->ioc = QIO_CHANNEL(tioc);