]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: cli: crash when trying to access a worker
authorWilliam Lallemand <wlallemand@haproxy.com>
Thu, 8 Nov 2018 11:00:14 +0000 (12:00 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 8 Nov 2018 13:48:06 +0000 (14:48 +0100)
When using the CLI proxy of the master and trying to access a worker
with the @ prefix, the worker just crash.

The commit 7216032 ("MEDIUM: mworker: leave when the master die")
reintroduced the old code of the pipe, which was not trying to access
the pointers before. The owner of the FD was modified to a different
value, this is a problem since we call listener_accept() in most cases
now from the mworker_accept_wrapper() and it casts the owner variable to
get the listener.

This patch fix the issue by setting back the previous owner of the FD.

src/haproxy.c

index 96e39be8b3d768d09c93d8b30f800e0cd25d781a..1d2971d4b43a8485ee737f3e9a11174e262a98db 100644 (file)
@@ -2592,7 +2592,7 @@ void mworker_pipe_register()
        /* In multi-tread, we need only one thread to process
         * events on the pipe with master
         */
-       fd_insert(proc_self->ipc_fd[1], proc_self->ipc_fd, mworker_accept_wrapper, 1);
+       fd_insert(proc_self->ipc_fd[1], fdtab[proc_self->ipc_fd[1]].owner, mworker_accept_wrapper, 1);
        fd_want_recv(proc_self->ipc_fd[1]);
 }