]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: proto_uxst: delete fd from fdtab if listen() fails
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Fri, 9 Aug 2024 09:05:41 +0000 (11:05 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Aug 2024 13:23:28 +0000 (15:23 +0200)
commiteb8235869027fe6f472160febb6edb169f38d1ee
treece8a1d6800e08a62945446f479e35c782e77bde5
parentf3c75a52df29247e5d502344127d42efb2c12b82
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.
src/proto_uxst.c