Skip to content

Commit

Permalink
l2tp: use rcu_dereference_sk_user_data() in l2tp_udp_encap_recv()
Browse files Browse the repository at this point in the history
Canonical way to fetch sk_user_data from an encap_rcv() handler called
from UDP stack in rcu protected section is to use rcu_dereference_sk_user_data(),
otherwise compiler might read it multiple times.

Fixes: d00fa9a ("il2tp: fix races with tunnel socket close")
Signed-off-by: Eric Dumazet <[email protected]>
Cc: James Chapman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Eric Dumazet authored and davem330 committed Apr 26, 2019
1 parent ad759c9 commit c1c4772
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/l2tp/l2tp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ int l2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
{
struct l2tp_tunnel *tunnel;

tunnel = l2tp_tunnel(sk);
tunnel = rcu_dereference_sk_user_data(sk);
if (tunnel == NULL)
goto pass_up;

Expand Down

0 comments on commit c1c4772

Please sign in to comment.