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: <Z6CKYA8ueI-ZGybN@hog>
Date: Mon, 3 Feb 2025 10:20:32 +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 17/25] ovpn: implement keepalive mechanism

2025-01-13, 10:31:36 +0100, Antonio Quartulli wrote:
> +void ovpn_xmit_special(struct ovpn_peer *peer, const void *data,
> +		       const unsigned int len)
> +{
> +	struct ovpn_priv *ovpn;
> +	struct sk_buff *skb;
> +
> +	ovpn = peer->ovpn;
> +	if (unlikely(!ovpn))
> +		return;
> +
> +	skb = alloc_skb(256 + len, GFP_ATOMIC);
> +	if (unlikely(!skb))
> +		return;
> +
> +	skb_reserve(skb, 128);
> +	skb->priority = TC_PRIO_BESTEFFORT;
> +	__skb_put_data(skb, data, len);
> +
> +	/* increase reference counter when passing peer to sending queue */
> +	if (!ovpn_peer_hold(peer)) {
> +		netdev_dbg(ovpn->dev,
> +			   "cannot hold peer reference for sending special packet\n");
> +		kfree_skb(skb);
> +		return;
> +	}
> +
> +	ovpn_send(ovpn, skb, peer);
> +}

[...]
> +static void ovpn_peer_keepalive_send(struct work_struct *work)
> +{
> +	struct ovpn_peer *peer = container_of(work, struct ovpn_peer,
> +					      keepalive_work);
> +
> +	local_bh_disable();
> +	ovpn_xmit_special(peer, ovpn_keepalive_message,
> +			  sizeof(ovpn_keepalive_message));
> +	local_bh_enable();
> +	ovpn_peer_put(peer);

nit: could we simply drop this put and the hold in ovpn_xmit_special?
ovpn_peer_keepalive_send has a reference on the peer from the WQ, just
transfer it to ovpn_xmit_special and then ovpn_send. No need to
pretend to acquire one for ovpn_send's sake and drop the one we got
from the WQ? (ovpn_xmit_special would need to _put(peer) in case of
early return)

> +}

-- 
Sabrina

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ