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: <5d7f805e-8b09-44cf-8d6b-e9c0b17909e9@openvpn.net>
Date: Tue, 26 Mar 2024 22:45:59 +0100
From: Antonio Quartulli <antonio@...nvpn.net>
To: Esben Haabendal <esben@...nix.com>
Cc: netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
 Sergey Ryazanov <ryazanov.s.a@...il.com>, Paolo Abeni <pabeni@...hat.com>,
 Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net-next v2 06/22] ovpn: introduce the ovpn_peer object

On 26/03/2024 11:34, Esben Haabendal wrote:
> Antonio Quartulli <antonio@...nvpn.net> writes:
> 
>> +static inline bool ovpn_bind_skb_src_match(const struct ovpn_bind *bind, struct sk_buff *skb)
>> +{
>> +	const unsigned short family = skb_protocol_to_family(skb);
>> +	const struct ovpn_sockaddr *sa = &bind->sa;
> 
> You should move this dereferencing of bind to after the following check
> to avoid segmentation fault.

ouch. good catch, thanks!

> 
>> +	if (unlikely(!bind))
>> +		return false;
> 
>> diff --git a/drivers/net/ovpn/peer.c b/drivers/net/ovpn/peer.c
>> new file mode 100644
>> index 000000000000..4319271927a4
>> --- /dev/null
>> +++ b/drivers/net/ovpn/peer.c
>> +
>> +/* Use with kref_put calls, when releasing refcount
>> + * on ovpn_peer objects.  This method should only
>> + * be called from process context with config_mutex held.
>> + */
>> +void ovpn_peer_release_kref(struct kref *kref)
>> +{
>> +	struct ovpn_peer *peer = container_of(kref, struct ovpn_peer, refcount);
>> +
>> +	INIT_WORK(&peer->delete_work, ovpn_peer_delete_work);
> 
> Is this safe, or could we end up re-initializing delete_work while it is
> queued or running?

ovpn_peer_release_kref() is only invoked once upon peer refcounter 
reaching 0 (then the peer object is erased).
Therefore it should be safe to init the work object here.

Cheers,

> 
>> +	queue_work(peer->ovpn->events_wq, &peer->delete_work);
> 
> /Esben

-- 
Antonio Quartulli
OpenVPN Inc.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ