lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aPYMHdIX68S1Yk-l@krikkit>
Date: Mon, 20 Oct 2025 12:17:01 +0200
From: Sabrina Dubroca <sd@...asysnail.net>
To: Ralf Lici <ralf@...delbit.com>
Cc: netdev@...r.kernel.org, Antonio Quartulli <antonio@...nvpn.net>,
	Andrew Lunn <andrew+netdev@...n.ch>,
	"David S . Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net v2 3/3] ovpn: use datagram_poll_queue for socket
 readiness in TCP

2025-10-20, 09:37:31 +0200, Ralf Lici wrote:
> diff --git a/drivers/net/ovpn/tcp.c b/drivers/net/ovpn/tcp.c
> index 289f62c5d2c7..308fdbb75cea 100644
> --- a/drivers/net/ovpn/tcp.c
> +++ b/drivers/net/ovpn/tcp.c
> @@ -560,16 +560,34 @@ static void ovpn_tcp_close(struct sock *sk, long timeout)
>  static __poll_t ovpn_tcp_poll(struct file *file, struct socket *sock,
>  			      poll_table *wait)
>  {
> -	__poll_t mask = datagram_poll(file, sock, wait);
> +	struct sk_buff_head *queue = &sock->sk->sk_receive_queue;
>  	struct ovpn_socket *ovpn_sock;
> +	struct ovpn_peer *peer = NULL;
> +	__poll_t mask;
>  
>  	rcu_read_lock();
>  	ovpn_sock = rcu_dereference_sk_user_data(sock->sk);
> -	if (ovpn_sock && ovpn_sock->peer &&
> -	    !skb_queue_empty(&ovpn_sock->peer->tcp.user_queue))
> -		mask |= EPOLLIN | EPOLLRDNORM;
> +	/* if we landed in this callback, we expect to have a
> +	 * meaningful state. The ovpn_socket lifecycle would
> +	 * prevent it otherwise.
> +	 */
> +	if (WARN_ON(!ovpn_sock || !ovpn_sock->peer)) {
> +		rcu_read_unlock();
> +		pr_err_ratelimited("ovpn: null state in ovpn_tcp_poll!\n");

nit: the extra print is not really necessary once we've done a full
WARN. But if you want the custom message alongside the WARN, maybe:

if (WARN(!ovpn_sock || !ovpn_sock->peer, "ovpn: null state in ovpn_tcp_poll!")) {
	...
}

(you can find examples of the "if (WARN(cond, msg))" pattern in
net/core/skbuff.c:
drop_reasons_register_subsys/drop_reasons_unregister_subsys
and other places)

Other than that, the patch looks good, thanks.

> +		return 0;
> +	}

-- 
Sabrina

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ