Re: [PATCH net 1/2] ovpn: tcp - use cached peer pointer in ovpn_tcp_close()
From: Antonio Quartulli
Date: Tue May 12 2026 - 11:11:37 EST
On 12/05/2026 16:11, Sabrina Dubroca wrote:
2026-05-12, 15:55:39 +0200, Antonio Quartulli wrote:
Hi,
On 12/05/2026 06:56, David CARLIER wrote:
Same multi-read pattern shows up in ovpn_tcp_recvmsg(),
ovpn_tcp_sendmsg(), ovpn_tcp_data_ready() and ovpn_tcp_write_space()
- happy to roll those into v2 as well, or punt to a follow-up,
whichever you'd prefer.
@Eric, if you have no objection, I'd pick this patch up in my tree and let
David follow with a new patch for net-next.
But this patch is not fixing any problem either, right?
Mh, because the sock outlives the peer, so there is no risk in accessing sock->peer in this case, right?
> Then just wait until David sends the whole change at once?
Yap.
And since the "rcu_dereference_sk_user_data + !sock || !sock->peer ||
!ovpn_peer_hold(sock->peer)" pattern is used multiple times, it would
be better to turn it into a helper (ovpn_tcp_get_peer()?). That way
the caller can't be tempted to play with sock->peer.
(also, please wait at least the usual 24 hours before applying)
ACK
Cheers,
--
Antonio Quartulli
OpenVPN Inc.