mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 06:21:08 +00:00
{commands,start}: remove element from list first
First remove the client from the list then close the fd. Otherwise we open ourselves to a race where another codepath might be writing to a bad file descriptor. Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
81084dbd0e
commit
300d1cb40a
@ -1156,8 +1156,8 @@ static void lxc_cmd_fd_cleanup(int fd, struct lxc_handler *handler,
|
||||
continue;
|
||||
|
||||
/* kick client from list */
|
||||
close(client->clientfd);
|
||||
lxc_list_del(cur);
|
||||
close(client->clientfd);
|
||||
free(cur->elem);
|
||||
free(cur);
|
||||
/* No need to walk the whole list. If we found the state client
|
||||
|
@ -427,8 +427,8 @@ int lxc_serve_state_clients(const char *name, struct lxc_handler *handler,
|
||||
}
|
||||
|
||||
/* kick client from list */
|
||||
close(client->clientfd);
|
||||
lxc_list_del(cur);
|
||||
close(client->clientfd);
|
||||
free(cur->elem);
|
||||
free(cur);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user