[CRIU] [PATCH 6/6] socket: prevent dumping of sockets if they are not collected

Pavel Emelyanov xemul at parallels.com
Thu Mar 28 07:38:31 EDT 2013


> @@ -226,11 +227,18 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa
>  	struct inet_sk_desc *sk;
>  	InetSkEntry ie = INET_SK_ENTRY__INIT;
>  	SkOptsEntry skopts = SK_OPTS_ENTRY__INIT;
> -	int ret = -1, err = -1;
> +	int ret = -1, err = -1, proto;
>  
> -	sk = (struct inet_sk_desc *)lookup_socket(p->stat.st_ino, family);
> +	ret = do_dump_opt(lfd, SOL_SOCKET, SO_PROTOCOL,
> +					&proto, sizeof(proto));

sk->proto can be dropped in that case.

> +	if (ret)
> +		goto err;
> +
> +	sk = (struct inet_sk_desc *)lookup_socket(p->stat.st_ino, family, proto);
> +	if (IS_ERR(sk))
> +		goto err;
>  	if (!sk) {
> -		sk = gen_uncon_sk(lfd, p);
> +		sk = gen_uncon_sk(lfd, p, proto);
>  		if (!sk)
>  			goto err;
>  	}


More information about the CRIU mailing list