[CRIU] [PATCH] net: Fix namespace fd leak in get_socket_ns()

Andrei Vagin avagin at virtuozzo.com
Mon Feb 19 20:52:18 MSK 2018


Applied, thanks!
On Mon, Feb 19, 2018 at 11:51:12AM +0300, Kirill Tkhai wrote:
> We open ns_fd via ioctl(SIOCGSKNS), but never close. Fix that.
> 
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
>  criu/net.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/criu/net.c b/criu/net.c
> index 0176873e0..4019a789e 100644
> --- a/criu/net.c
> +++ b/criu/net.c
> @@ -2708,8 +2708,10 @@ struct ns_id *get_socket_ns(int lfd)
>  	}
>  	if (fstat(ns_fd, &st)) {
>  		pr_perror("Unable to stat a network namespace");
> +		close(ns_fd);
>  		return NULL;
>  	}
> +	close(ns_fd);
>  
>  	ns = lookup_ns_by_kid(st.st_ino, &net_ns_desc);
>  	if (ns == NULL) {
> 


More information about the CRIU mailing list