[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL (for 2.11) v1 1/1] sockets: avoid crash when cleaning

From: Daniel P. Berrange
Subject: [Qemu-devel] [PULL (for 2.11) v1 1/1] sockets: avoid crash when cleaning up sockets for an invalid FD
Date: Tue, 28 Nov 2017 11:23:01 +0000

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

Reported-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Daniel P. Berrange <address@hidden>
 util/qemu-sockets.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 8b75541ce4..a1cf47e625 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -1079,6 +1079,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) {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]