Subject: Re: [PATCH net-next v18 12/25] ovpn: implement TCP transport

From: Sabrina Dubroca <[email-masked]>
Date: Wed, 15 Jan 2025 18:25:43 +0100

@maintainers could I get another day or two to poke at the new socket
release mechanism? I haven't had time to look at it in depth yet.

Just a small thing I saw on this patch:

2025-01-13, 10:31:31 +0100, Antonio Quartulli wrote:
> +int ovpn_tcp_socket_attach(struct socket *sock, struct ovpn_peer *peer)
> +{
> +	struct strp_callbacks cb = {
> +		.rcv_msg = ovpn_tcp_rcv,
> +		.parse_msg = ovpn_tcp_parse,
> +	};
> +	int ret;
> +
> +	/* make sure no pre-existing encapsulation handler exists */
> +	if (sock->sk->sk_user_data)
> +		return -EBUSY;
> +
> +	/* only a fully connected socket is expected. Connection should be
> +	 * handled in userspace
> +	 */
> +	if (sock->sk->sk_state != TCP_ESTABLISHED) {
> +		net_err_ratelimited("%s: provided TCP socket is not in ESTABLISHED state: %d\n",
> +				    netdev_name(peer->ovpn->dev),
> +				    sock->sk->sk_state);
> +		return -EINVAL;
> +	}
> +
> +	ret = strp_init(&peer->tcp.strp, sock->sk, &cb);
> +	if (ret < 0) {
> +		DEBUG_NET_WARN_ON_ONCE(1);
> +		release_sock(sock->sk);

Leftover from the old locking scheme. Could probably get snipped when
applying if we decide this version is good otherwise.

> +		return ret;
> +	}

-- 
Sabrina