The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3280
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === If lxc_add_state_client() is called with the container already being in the desired state the client fd will never be closed and is leaking. This due to setting stay_connected in lxc_cmd for LXC_CMD_ADD_STATE_CLIENT. If the desired state isn't already achieved the client fd will later be closed by calling lxc_cmd_fd_cleanup() but in the other case the client configuration isn't added to the handlers state clients. So the client fd has to be closed explicitely. This is simply tested by starting container A and calling lxc-wait -n A -s RUNNING.
From 18b46cb3dc7133a13c4fa93ea6f508bd4dea405c Mon Sep 17 00:00:00 2001 From: Matthias Hardt <matthias.ha...@gmail.com> Date: Mon, 9 Mar 2020 15:53:11 +0100 Subject: [PATCH] commands_utils: fix socket leak in when adding state client If lxc_add_state_client() is called with the container already being in the desired state the client fd will never be closed and is leaking. This due to setting stay_connected in lxc_cmd for LXC_CMD_ADD_STATE_CLIENT. If the desired state isn't already achieved the client fd will later be closed by calling lxc_cmd_fd_cleanup() but in the other case the client configuration isn't added to the handlers state clients. So the client fd has to be closed explicitely. This is simply tested by starting container A and calling lxc-wait -n A -s RUNNING. --- src/lxc/commands_utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lxc/commands_utils.c b/src/lxc/commands_utils.c index 67edc4ca95..a8f1e17055 100644 --- a/src/lxc/commands_utils.c +++ b/src/lxc/commands_utils.c @@ -195,6 +195,7 @@ int lxc_add_state_client(int state_client_fd, struct lxc_handler *handler, lxc_list_add_elem(tmplist, newclient); lxc_list_add_tail(&handler->conf->state_clients, tmplist); } else { + close(state_client_fd); return state; }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel