Re: [PATCH ovpn net 1/9] ovpn: skip rehash for peers already removed from by_id
Antonio Quartulli <[email protected]>
| Newsgroups | gmane.network.openvpn.devel |
|---|---|
| Message-ID | <[email protected]> |
On 28/05/2026 20:24, Sabrina Dubroca wrote:
>> diff --git a/drivers/net/ovpn/peer.c b/drivers/net/ovpn/peer.c
>> index a09d61296425..a472ffe3016b 100644
>> --- a/drivers/net/ovpn/peer.c
>> +++ b/drivers/net/ovpn/peer.c
>> @@ -307,6 +307,16 @@ void ovpn_peer_endpoints_update(struct ovpn_peer *peer, struct sk_buff *skb)
>> return;
>> }
>>
>> + /* peer may have been concurrently removed between the caller's
>> + * initial lookup and our acquisition of ovpn->lock; skip the
>> + * rehash so we don't re-insert a removed peer
>> + */
>> + if (unlikely(hlist_unhashed(&peer->hash_entry_id))) {
>> + spin_unlock_bh(&peer->lock);
>> + spin_unlock_bh(&peer->ovpn->lock);
>> + return;
>> + }
>
> I'd add an "unlock2" label (or "unlock_both") to unlock both (maybe
> just after the "hlist_nulls_add_head_rcu", before the existing
> unlock). The unlock/return is a bit verbose and we have it 3 times
> after this patch.
Yap, make sense!
I'll respin the patch with this change.
Cheers,
--
Antonio Quartulli