Blame SOURCES/kvm-sockets-avoid-crash-when-cleaning-up-sockets-for-an-.patch

9bac43
From b76eb750ff4e5a698428465d6b54684d49319e40 Mon Sep 17 00:00:00 2001
9bac43
From: "Daniel P. Berrange" <berrange@redhat.com>
9bac43
Date: Fri, 8 Dec 2017 14:00:16 +0100
9bac43
Subject: [PATCH 21/21] sockets: avoid crash when cleaning up sockets for an
9bac43
 invalid FD
9bac43
9bac43
RH-Author: Daniel P. Berrange <berrange@redhat.com>
9bac43
Message-id: <20171208140016.29707-1-berrange@redhat.com>
9bac43
Patchwork-id: 78275
9bac43
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH] sockets: avoid crash when cleaning up sockets for an invalid FD
9bac43
Bugzilla: 1506218
9bac43
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9bac43
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
9bac43
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
9bac43
9bac43
If socket_listen_cleanup is passed an invalid FD, then querying the socket
9bac43
local address will fail. We must thus be prepared for the returned addr to
9bac43
be NULL
9bac43
9bac43
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9bac43
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9bac43
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9bac43
(cherry picked from commit 2d7ad7c05e762d5b10a57eba9af1bb6b41700854)
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 util/qemu-sockets.c | 3 +++
9bac43
 1 file changed, 3 insertions(+)
9bac43
9bac43
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
9bac43
index 1358c81..bca6a06 100644
9bac43
--- a/util/qemu-sockets.c
9bac43
+++ b/util/qemu-sockets.c
9bac43
@@ -1190,6 +1190,9 @@ void socket_listen_cleanup(int fd, Error **errp)
9bac43
     SocketAddress *addr;
9bac43
 
9bac43
     addr = socket_local_address(fd, errp);
9bac43
+    if (!addr) {
9bac43
+        return;
9bac43
+    }
9bac43
 
9bac43
     if (addr->type == SOCKET_ADDRESS_TYPE_UNIX
9bac43
         && addr->u.q_unix.path) {
9bac43
-- 
9bac43
1.8.3.1
9bac43