qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] sockets: avoid crash when cleaning up sockets for an invalid FD
Date: Fri, 27 Oct 2017 13:29:48 +0100	[thread overview]
Message-ID: <20171027122948.GA2135@work-vm> (raw)
In-Reply-To: <20171027085633.14367-1-berrange@redhat.com>

* Daniel P. Berrange (berrange@redhat.com) wrote:
> If socket_listen_cleanup is passed an invalid FD, then querying the socket
> local address will fail. We must thus be prepared for the returned addr to
> be NULL
> 
> Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  util/qemu-sockets.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
> index b47fb45885..c7fdaa63fb 100644
> --- a/util/qemu-sockets.c
> +++ b/util/qemu-sockets.c
> @@ -1073,6 +1073,9 @@ void socket_listen_cleanup(int fd, Error **errp)
>      SocketAddress *addr;
>  
>      addr = socket_local_address(fd, errp);
> +    if (!addr) {
> +        return;
> +    }
>  
>      if (addr->type == SOCKET_ADDRESS_TYPE_UNIX
>          && addr->u.q_unix.path) {
> -- 
> 2.13.6
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

      reply	other threads:[~2017-10-27 12:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27  8:56 [Qemu-devel] [PATCH] sockets: avoid crash when cleaning up sockets for an invalid FD Daniel P. Berrange
2017-10-27 12:29 ` Dr. David Alan Gilbert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171027122948.GA2135@work-vm \
    --to=dgilbert@redhat.com \
    --cc=berrange@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).