ovpn: fix incorrect use of rcu_access_pointer()
Subsystems (2)
PATCH v2 1/1 ovpn: fix incorrect use of rcu_access_pointer()
rcu_access_pointer() should only be used to test the value of a pointer, not to dereference it. As it's in a spin_lock_bh() critical section, use rcu_dereference_bh() instead, avoiding an extra rcu_read_lock().
Fixes f6226ae7a0cd ("ovpn: introduce the ovpn_socket object")
Signed-off-by Qingfang Deng <[email protected]>
---
v2: use rcu_dereference_bh() to make lockdep happy
drivers/net/ovpn/peer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ovpn/peer.c +1 -1
@@ -1165,7 +1165,7 @@ static void ovpn_peer_release_p2p(struct ovpn_priv *ovpn, struct sock *sk, }if (sk) { - ovpn_sock =rcu_access_pointer (peer->sock); + ovpn_sock =rcu_dereference_bh (peer->sock);if (!ovpn_sock || ovpn_sock->sk != sk) {spin_unlock_bh (&ovpn->lock);return ;
Signature · 8 lines
2.43.0 _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Antonio Quartulli
AppliedQuoted 6 lines · Qingfang Deng
rcu_access_pointer()should only be used to test the value of a pointer, not to dereference it. As it's in aspin_lock_bh()critical section, usercu_dereference_bh()instead, avoiding an extrarcu_read_lock().Fixes f6226ae7a0cd ("ovpn: introduce the ovpn_socket object")Signed-off-by Qingfang Deng <[email protected]>
Applied, commit 55c6dcf4e97e7fa82b29015378342f6f14657d0b
Thanks!
Signature · 8 lines
Antonio Quartulli _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel