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

Andrei Vagin avagin at virtuozzo.com
Fri Feb 23 11:25:43 MSK 2018


On Wed, Feb 21, 2018 at 02:36:33PM +0300, Kirill Tkhai wrote:
> On 19.02.2018 20:52, Andrei Vagin wrote:
> > Applied, thanks!
> 
> JFI: It has not appeared in git repository.

I forgot to call "git push", now it should be there.


> 
> > 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