mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-15 07:51:04 +01:00
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.
This commit is contained in:
parent
8c27bcaea0
commit
7319b64fc4
@ -309,11 +309,11 @@ static int uxst_bind_listener(struct listener *listener, char *errmsg, int errle
|
|||||||
if (ret < 0 && errno == ENOENT)
|
if (ret < 0 && errno == ENOENT)
|
||||||
unlink(path);
|
unlink(path);
|
||||||
err_unlink_temp:
|
err_unlink_temp:
|
||||||
if (!ext)
|
if (!ext && path[0])
|
||||||
unlink(tempname);
|
unlink(tempname);
|
||||||
close(fd);
|
close(fd);
|
||||||
err_unlink_back:
|
err_unlink_back:
|
||||||
if (!ext)
|
if (!ext && path[0])
|
||||||
unlink(backname);
|
unlink(backname);
|
||||||
err_return:
|
err_return:
|
||||||
if (msg && errlen) {
|
if (msg && errlen) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user