Skip to content

Commit 1461f5a

Browse files
Cong Wangkuba-moo
authored andcommitted
l2tp: avoid overriding sk->sk_user_data
Although commit 4a4cd70 ("l2tp: don't set sk_user_data in tunnel socket") removed sk->sk_user_data usage, setup_udp_tunnel_sock() still touches sk->sk_user_data, this conflicts with sockmap which also leverages sk->sk_user_data to save psock. Restore this sk->sk_user_data check to avoid such conflicts. Fixes: 4a4cd70 ("l2tp: don't set sk_user_data in tunnel socket") Reported-by: [email protected] Cc: Tom Parkin <[email protected]> Signed-off-by: Cong Wang <[email protected]> Tested-by: James Chapman <[email protected]> Reviewed-by: James Chapman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7888173 commit 1461f5a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/l2tp/l2tp_core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,6 +1620,9 @@ static int l2tp_validate_socket(const struct sock *sk, const struct net *net,
16201620
(encap == L2TP_ENCAPTYPE_IP && sk->sk_protocol != IPPROTO_L2TP))
16211621
return -EPROTONOSUPPORT;
16221622

1623+
if (encap == L2TP_ENCAPTYPE_UDP && sk->sk_user_data)
1624+
return -EBUSY;
1625+
16231626
tunnel = l2tp_sk_to_tunnel(sk);
16241627
if (tunnel) {
16251628
l2tp_tunnel_put(tunnel);

0 commit comments

Comments
 (0)