|
From 76ad998e2b6ae852567ff53edb84a0b467c0c9cb Mon Sep 17 00:00:00 2001
|
|
From: Jan Seda <hodor@hodor.cz>
|
|
Date: Thu, 26 Jun 2014 20:44:05 +0200
|
|
Subject: [PATCH 11/12] BUG/MEDIUM: unix: do not unlink() abstract namespace
|
|
sockets upon failure.
|
|
|
|
When bind() fails (function uxst_bind_listener()), the fail path doesn't
|
|
consider the abstract namespace and tries to unlink paths held in
|
|
uninitiliazed memory (tempname and backname). See the strace excerpt;
|
|
the strings still hold the path from test1.
|
|
|
|
===============================================================================================
|
|
23722 bind(5, {sa_family=AF_FILE, path=@"test2"}, 110) = -1 EADDRINUSE (Address already in use)
|
|
23722 unlink("/tmp/test1.sock.23722.tmp") = -1 ENOENT (No such file or directory)
|
|
23722 close(5) = 0
|
|
23722 unlink("/tmp/test1.sock.23722.bak") = -1 ENOENT (No such file or directory)
|
|
===============================================================================================
|
|
|
|
This patch should be backported to 1.5.
|
|
(cherry picked from commit 7319b64fc4c9b7e04726816c6cc02f6ecf66a0a4)
|
|
---
|
|
src/proto_uxst.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
|
|
index f83d34e..c9a52ff 100644
|
|
--- a/src/proto_uxst.c
|
|
+++ b/src/proto_uxst.c
|
|
@@ -309,11 +309,11 @@ static int uxst_bind_listener(struct listener *listener, char *errmsg, int errle
|
|
if (ret < 0 && errno == ENOENT)
|
|
unlink(path);
|
|
err_unlink_temp:
|
|
- if (!ext)
|
|
+ if (!ext && path[0])
|
|
unlink(tempname);
|
|
close(fd);
|
|
err_unlink_back:
|
|
- if (!ext)
|
|
+ if (!ext && path[0])
|
|
unlink(backname);
|
|
err_return:
|
|
if (msg && errlen) {
|
|
--
|
|
1.8.5.5
|
|
|