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: <Z49osyyCSxWoe2-X@hog>
Date: Tue, 21 Jan 2025 10:28:19 +0100
From: Sabrina Dubroca <sd@...asysnail.net>
To: Antonio Quartulli <antonio@...nvpn.net>
Cc: netdev@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Donald Hunter <donald.hunter@...il.com>,
	Shuah Khan <shuah@...nel.org>, ryazanov.s.a@...il.com,
	Andrew Lunn <andrew+netdev@...n.ch>,
	Simon Horman <horms@...nel.org>, linux-kernel@...r.kernel.org,
	linux-kselftest@...r.kernel.org, Xiao Liang <shaw.leon@...il.com>
Subject: Re: [PATCH net-next v18 12/25] ovpn: implement TCP transport

2025-01-20, 15:12:28 +0100, Antonio Quartulli wrote:
> On 17/01/2025 18:14, Sabrina Dubroca wrote:
> > 2025-01-13, 10:31:31 +0100, Antonio Quartulli wrote:
> > > +static int ovpn_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
> > > +			    int flags, int *addr_len)
> > > +{
> > > +	int err = 0, off, copied = 0, ret;
> > > +	struct ovpn_socket *sock;
> > > +	struct ovpn_peer *peer;
> > > +	struct sk_buff *skb;
> > > +
> > > +	rcu_read_lock();
> > > +	sock = rcu_dereference_sk_user_data(sk);
> > > +	if (!sock || !sock->peer) {
> > > +		rcu_read_unlock();
> > > +		return -EBADF;
> > > +	}
> > > +	/* we take a reference to the peer linked to this TCP socket, because
> > > +	 * in turn the peer holds a reference to the socket itself.
> 
> Going back now to this specific comment:
> 
> > 
> > Not anymore since v12? [*]
> > 
> > I think it's ok here because we're only using peer and sk (not
> > anything from ovpn_socket), but it is relevant in _sendmsg, which has
> > the same peer_hold pattern without this comment.
> 
> After applying to _sendmsg() the modifications you suggested (i.e. reference
> peer directly instead of sock->peer), it also only uses peer and sk, but not
> ovpn_socket.
> Therefore it should be fine too.
> 
> This said, the comment above should go away or at least should be modified.

It can probably go away completely, taking a ref on an object we're
clearly using is reasonable and I don't think it requires an
explanation, unlike the old scheme with dependencies (which was not
completely obvious). Thanks.

-- 
Sabrina

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ