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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a3572fe174353ee629499f97668c14253083a7fc.camel@mandelbit.com>
Date: Mon, 20 Oct 2025 14:22:01 +0200
From: Ralf Lici <ralf@...delbit.com>
To: Sabrina Dubroca <sd@...asysnail.net>
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

On Mon, 2025-10-20 at 12:17 +0200, Sabrina Dubroca wrote:
> 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)

I wasn't aware of this macro, thanks for pointing it out. I'll use it on
the next version.

-- 
Ralf Lici
Mandelbit Srl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ