Re: [PATCH ovpn-net] ovpn: fix incorrect use of rcu_access_pointer()

Qingfang Deng <[email protected]> Fri, 24 Jul 2026 09:20:51 +0800
Newsgroups gmane.network.openvpn.devel
Message-ID <[email protected]>
Hi Ralf,

On 2026/7/23 15:59, Ralf Lici wrote:
> rcu_dereference relies on rcu_read_lock_held to check that the caller
> context is valid. However, ovpn_peer_release_p2p does not hold a normal
> rcu_read_lock section, it relies on the BH-disabled section established
> by spin_lock_bh instead.
>
> rcu_read_lock_held does not consider BH-disabled context, so it will
> return false here. In contrast, rcu_read_lock_bh_held explicitly
> recognizes BH-disabled/softirq context.
>
> So I think Sashiko is right: rcu_dereference will trigger its RCU
> lockdep warning with CONFIG_PROVE_RCU enabled. This should use
> rcu_dereference_bh instead.

I read the code, and found that you are correct. I'll submit a new patch 
with your suggested change. Thank you.

Best regards,

Qingfang