From: Valentine Krasnobaeva Date: Fri, 9 Aug 2024 09:05:41 +0000 (+0200) Subject: BUG/MINOR: proto_uxst: delete fd from fdtab if listen() fails X-Git-Tag: v3.1-dev6~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb8235869027fe6f472160febb6edb169f38d1ee;p=thirdparty%2Fhaproxy.git BUG/MINOR: proto_uxst: delete fd from fdtab if listen() fails This patch is done mostly as a safeguard in order not to trigger BUG_ON(fdtab[fd].owner != NULL) check, if listen() will fail on UNIX domain socket. In uxst_bind_listener(), the pretty same logic of closing socket on error path was kept, as it was in tcp_bind_listener() before. The use of fd_delete() was not generalized, when the support of UNIX sock_stream protocol was implemented. So, let's remove fd from fdtab on failure, instead of closing it. Otherwise, uxst_bind_listener(), which could be called in loop for each receiver, will obtain the same fd via socket() for the next receiver. Then, it will bind it again and it will try to re-insert it in fdtab. This can be backported to all stable versions. --- diff --git a/src/proto_uxst.c b/src/proto_uxst.c index 7828e31831..9c739c3fe3 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -143,7 +143,7 @@ static int uxst_bind_listener(struct listener *listener, char *errmsg, int errle return err; uxst_close_return: - close(fd); + fd_delete(fd); uxst_return: if (msg && errlen) { char *path_str;