linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Antonio Quartulli <antonio@openvpn.net>
Cc: netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Donald Hunter <donald.hunter@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	ryazanov.s.a@gmail.com, Andrew Lunn <andrew+netdev@lunn.ch>,
	Simon Horman <horms@kernel.org>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Xiao Liang <shaw.leon@gmail.com>
Subject: Re: [PATCH net-next v18 12/25] ovpn: implement TCP transport
Date: Tue, 21 Jan 2025 10:28:19 +0100	[thread overview]
Message-ID: <Z49osyyCSxWoe2-X@hog> (raw)
In-Reply-To: <6ef40195-9648-40db-8e36-a2a0095aa411@openvpn.net>

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

  reply	other threads:[~2025-01-21  9:28 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13  9:31 [PATCH net-next v18 00/25] Introducing OpenVPN Data Channel Offload Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 01/25] net: introduce OpenVPN Data Channel Offload (ovpn) Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 02/25] ovpn: add basic netlink support Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 03/25] ovpn: add basic interface creation/destruction/management routines Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 04/25] ovpn: keep carrier always on for MP interfaces Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 05/25] ovpn: introduce the ovpn_peer object Antonio Quartulli
2025-01-17 11:58   ` Sabrina Dubroca
2025-01-17 12:26     ` Antonio Quartulli
2025-02-02 22:56   ` Sabrina Dubroca
2025-02-03  8:41     ` Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 06/25] ovpn: introduce the ovpn_socket object Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 07/25] ovpn: implement basic TX path (UDP) Antonio Quartulli
2025-02-03  9:52   ` Sabrina Dubroca
2025-02-04 16:18     ` Sabrina Dubroca
2025-02-05  9:12       ` Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 08/25] ovpn: implement basic RX " Antonio Quartulli
2025-02-03  9:30   ` Sabrina Dubroca
2025-02-03  9:58     ` Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 09/25] ovpn: implement packet processing Antonio Quartulli
2025-01-17 12:16   ` Sabrina Dubroca
2025-01-17 12:28     ` Antonio Quartulli
2025-02-05 21:50   ` Sabrina Dubroca
2025-02-07 13:13     ` Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 10/25] ovpn: store tunnel and transport statistics Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 11/25] ipv6: export inet6_stream_ops via EXPORT_SYMBOL_GPL Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 12/25] ovpn: implement TCP transport Antonio Quartulli
2025-01-15 17:25   ` Sabrina Dubroca
2025-01-15 17:55     ` Jakub Kicinski
2025-01-17 17:14   ` Sabrina Dubroca
2025-01-19 20:06     ` Antonio Quartulli
2025-01-20 14:12     ` Antonio Quartulli
2025-01-21  9:28       ` Sabrina Dubroca [this message]
2025-02-03 10:05   ` Sabrina Dubroca
2025-02-03 13:12     ` Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 13/25] skb: implement skb_send_sock_locked_with_flags() Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 14/25] ovpn: add support for MSG_NOSIGNAL in tcp_sendmsg Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 15/25] ovpn: implement multi-peer support Antonio Quartulli
2025-02-02 23:00   ` Sabrina Dubroca
2025-02-03  9:01     ` Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 16/25] ovpn: implement peer lookup logic Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 17/25] ovpn: implement keepalive mechanism Antonio Quartulli
2025-02-03  9:20   ` Sabrina Dubroca
2025-02-03  9:55     ` Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 18/25] ovpn: add support for updating local UDP endpoint Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 19/25] ovpn: add support for peer floating Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 20/25] ovpn: implement peer add/get/dump/delete via netlink Antonio Quartulli
2025-01-17 11:48   ` Sabrina Dubroca
2025-01-17 12:59     ` Antonio Quartulli
2025-01-17 17:12       ` Sabrina Dubroca
2025-01-19 13:12         ` Antonio Quartulli
2025-01-20 10:09           ` Sabrina Dubroca
2025-01-20 10:45             ` Antonio Quartulli
2025-01-20 21:20               ` Antonio Quartulli
2025-01-21  9:59                 ` Sabrina Dubroca
2025-01-21 10:10                   ` Antonio Quartulli
2025-01-21  9:39               ` Sabrina Dubroca
2025-01-21  9:48                 ` Antonio Quartulli
2025-01-20 14:52     ` Antonio Quartulli
2025-01-21 23:26       ` Antonio Quartulli
2025-01-22  8:45         ` Sabrina Dubroca
2025-01-22  0:40     ` Antonio Quartulli
2025-01-22  8:51       ` Sabrina Dubroca
2025-01-22  9:00         ` Antonio Quartulli
2025-02-02 23:07   ` Sabrina Dubroca
2025-02-03  9:46     ` Antonio Quartulli
2025-02-03 10:42       ` Sabrina Dubroca
2025-01-13  9:31 ` [PATCH net-next v18 21/25] ovpn: implement key add/get/del/swap " Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 22/25] ovpn: kill key and notify userspace in case of IV exhaustion Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 23/25] ovpn: notify userspace when a peer is deleted Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 24/25] ovpn: add basic ethtool support Antonio Quartulli
2025-01-13  9:31 ` [PATCH net-next v18 25/25] testing/selftests: add test tool and scripts for ovpn module Antonio Quartulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z49osyyCSxWoe2-X@hog \
    --to=sd@queasysnail.net \
    --cc=andrew+netdev@lunn.ch \
    --cc=antonio@openvpn.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ryazanov.s.a@gmail.com \
    --cc=shaw.leon@gmail.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).