Re: [PATCH v2] ovpn: fix peer refcount leak in TCP error paths

From: Antonio Quartulli

Date: Fri May 22 2026 - 05:21:34 EST


Hi,

On 22/05/2026 11:17, Pavitra Jha wrote:
diff --git a/drivers/net/ovpn/tcp.c b/drivers/net/ovpn/tcp.c
index d651ce85c..2c7d830e7 100644
--- a/drivers/net/ovpn/tcp.c
+++ b/drivers/net/ovpn/tcp.c
@@ -283,9 +283,9 @@ static void ovpn_tcp_send_sock(struct ovpn_peer *peer, struct sock *sk)
/* in case of TCP error we can't recover the VPN
* stream therefore we abort the connection
*/
- if (ovpn_peer_hold(peer))
- if (!schedule_work(&peer->tcp.defer_del_work))
- ovpn_peer_put(peer);
+ ovpn_peer_hold(peer);
+ if (!schedule_work(&peer->tcp.defer_del_work))
+ ovpn_peer_put(peer);
/* we bail out immediately and keep tx_in_progress set
* to true. This way we prevent more TX attempts

This patch now lacks the RX part.

Please wait 24h between submissions (i.e. before sending v3).
More comments may come in in the meantime.

Regards,

--
Antonio Quartulli
OpenVPN Inc.