All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] char: fix missing return in error path for chardev TLS init
@ 2016-09-30 15:02 Daniel P. Berrange
  2016-09-30 15:47 ` Eric Blake
  2016-10-08  8:15 ` Michael Tokarev
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel P. Berrange @ 2016-09-30 15:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, qemu-trivial, Paolo Bonzini, Daniel P. Berrange

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>
---
 qemu-char.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qemu-char.c b/qemu-char.c
index fb456ce..48a45ef 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] char: fix missing return in error path for chardev TLS init
  2016-09-30 15:02 [Qemu-devel] [PATCH] char: fix missing return in error path for chardev TLS init Daniel P. Berrange
@ 2016-09-30 15:47 ` Eric Blake
  2016-10-08  8:15 ` Michael Tokarev
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2016-09-30 15:47 UTC (permalink / raw)
  To: Daniel P. Berrange, qemu-devel; +Cc: qemu-trivial, Paolo Bonzini, qemu-stable

[-- Attachment #1: Type: text/plain, Size: 882 bytes --]

On 09/30/2016 10:02 AM, Daniel P. Berrange wrote:
> 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>
> ---
>  qemu-char.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] char: fix missing return in error path for chardev TLS init
  2016-09-30 15:02 [Qemu-devel] [PATCH] char: fix missing return in error path for chardev TLS init Daniel P. Berrange
  2016-09-30 15:47 ` Eric Blake
@ 2016-10-08  8:15 ` Michael Tokarev
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2016-10-08  8:15 UTC (permalink / raw)
  To: Daniel P. Berrange, qemu-devel; +Cc: qemu-trivial, Paolo Bonzini, qemu-stable

30.09.2016 18:02, Daniel P. Berrange wrote:
> 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.

Applied to -trivial, thanks!

/mjt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-08  8:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-30 15:02 [Qemu-devel] [PATCH] char: fix missing return in error path for chardev TLS init Daniel P. Berrange
2016-09-30 15:47 ` Eric Blake
2016-10-08  8:15 ` Michael Tokarev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.