提交 660a2d83 编写于 作者: D Daniel P. Berrange 提交者: Michael Tokarev

char: fix missing return in error path for chardev TLS init

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: NDaniel P. Berrange <berrange@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
上级 56bef851
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册