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: <943b6994-f87b-4e8b-a5ff-3f6680070cc4@openvpn.net>
Date: Tue, 3 Dec 2024 16:04:12 +0100
From: Antonio Quartulli <antonio@...nvpn.net>
To: Paolo Abeni <pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Donald Hunter <donald.hunter@...il.com>,
 Shuah Khan <shuah@...nel.org>, sd@...asysnail.net, ryazanov.s.a@...il.com,
 Andrew Lunn <andrew@...n.ch>
Cc: Simon Horman <horms@...nel.org>, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH net-next v12 09/22] ovpn: implement packet processing

On 03/12/2024 15:58, Paolo Abeni wrote:
> On 12/2/24 16:07, Antonio Quartulli wrote:
>> @@ -286,6 +292,31 @@ struct ovpn_peer *ovpn_peer_get_by_dst(struct ovpn_priv *ovpn,
>>   	return peer;
>>   }
>>   
>> +/**
>> + * ovpn_peer_check_by_src - check that skb source is routed via peer
>> + * @ovpn: the openvpn instance to search
>> + * @skb: the packet to extract source address from
>> + * @peer: the peer to check against the source address
>> + *
>> + * Return: true if the peer is matching or false otherwise
>> + */
>> +bool ovpn_peer_check_by_src(struct ovpn_priv *ovpn, struct sk_buff *skb,
>> +			    struct ovpn_peer *peer)
>> +{
>> +	bool match = false;
>> +
>> +	if (ovpn->mode == OVPN_MODE_P2P) {
>> +		/* in P2P mode, no matter the destination, packets are always
>> +		 * sent to the single peer listening on the other side
>> +		 */
>> +		rcu_read_lock();
>> +		match = (peer == rcu_dereference(ovpn->peer));
>> +		rcu_read_unlock();
> 
> Here you are not dereferencing ovpn->peer, so you can use
> rcu_access_pointer() instead and avoid the rcu_read_lock/unlock() pair.

I see - thanks for pointing this out!
Will switch to rcu_access_pointer().

Regards,

-- 
Antonio Quartulli
OpenVPN Inc.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ