* [Patch net-next] l2tp: avoid overriding sk->sk_user_data
@ 2024-08-22 18:25 Cong Wang
2024-08-23 7:13 ` James Chapman
2024-08-26 17:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Cong Wang @ 2024-08-22 18:25 UTC (permalink / raw)
To: netdev; +Cc: Cong Wang, syzbot+8dbe3133b840c470da0e, James Chapman, Tom Parkin
From: Cong Wang <cong.wang@bytedance.com>
Although commit 4a4cd70369f1 ("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: 4a4cd70369f1 ("l2tp: don't set sk_user_data in tunnel socket")
Reported-by: syzbot+8dbe3133b840c470da0e@syzkaller.appspotmail.com
Cc: James Chapman <jchapman@katalix.com>
Cc: Tom Parkin <tparkin@katalix.com>
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
---
net/l2tp/l2tp_core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index af87c781d6a6..df73c35363cb 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1620,6 +1620,9 @@ static int l2tp_validate_socket(const struct sock *sk, const struct net *net,
(encap == L2TP_ENCAPTYPE_IP && sk->sk_protocol != IPPROTO_L2TP))
return -EPROTONOSUPPORT;
+ if (encap == L2TP_ENCAPTYPE_UDP && sk->sk_user_data)
+ return -EBUSY;
+
tunnel = l2tp_sk_to_tunnel(sk);
if (tunnel) {
l2tp_tunnel_put(tunnel);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch net-next] l2tp: avoid overriding sk->sk_user_data
2024-08-22 18:25 [Patch net-next] l2tp: avoid overriding sk->sk_user_data Cong Wang
@ 2024-08-23 7:13 ` James Chapman
2024-08-26 17:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: James Chapman @ 2024-08-23 7:13 UTC (permalink / raw)
To: Cong Wang, netdev; +Cc: Cong Wang, syzbot+8dbe3133b840c470da0e, Tom Parkin
On 22/08/2024 19:25, Cong Wang wrote:
> From: Cong Wang <cong.wang@bytedance.com>
>
> Although commit 4a4cd70369f1 ("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: 4a4cd70369f1 ("l2tp: don't set sk_user_data in tunnel socket")
> Reported-by: syzbot+8dbe3133b840c470da0e@syzkaller.appspotmail.com
> Cc: James Chapman <jchapman@katalix.com>
> Cc: Tom Parkin <tparkin@katalix.com>
> Signed-off-by: Cong Wang <cong.wang@bytedance.com>
> ---
> net/l2tp/l2tp_core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
> index af87c781d6a6..df73c35363cb 100644
> --- a/net/l2tp/l2tp_core.c
> +++ b/net/l2tp/l2tp_core.c
> @@ -1620,6 +1620,9 @@ static int l2tp_validate_socket(const struct sock *sk, const struct net *net,
> (encap == L2TP_ENCAPTYPE_IP && sk->sk_protocol != IPPROTO_L2TP))
> return -EPROTONOSUPPORT;
>
> + if (encap == L2TP_ENCAPTYPE_UDP && sk->sk_user_data)
> + return -EBUSY;
> +
> tunnel = l2tp_sk_to_tunnel(sk);
> if (tunnel) {
> l2tp_tunnel_put(tunnel);
Thanks Cong
Tested-by: James Chapman <jchapman@katalix.com>
Reviewed-by: James Chapman <jchapman@katalix.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch net-next] l2tp: avoid overriding sk->sk_user_data
2024-08-22 18:25 [Patch net-next] l2tp: avoid overriding sk->sk_user_data Cong Wang
2024-08-23 7:13 ` James Chapman
@ 2024-08-26 17:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-26 17:10 UTC (permalink / raw)
To: Cong Wang
Cc: netdev, cong.wang, syzbot+8dbe3133b840c470da0e, jchapman, tparkin
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 22 Aug 2024 11:25:44 -0700 you wrote:
> From: Cong Wang <cong.wang@bytedance.com>
>
> Although commit 4a4cd70369f1 ("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.
>
> [...]
Here is the summary with links:
- [net-next] l2tp: avoid overriding sk->sk_user_data
https://git.kernel.org/netdev/net-next/c/1461f5a3d810
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-26 17:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22 18:25 [Patch net-next] l2tp: avoid overriding sk->sk_user_data Cong Wang
2024-08-23 7:13 ` James Chapman
2024-08-26 17:10 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.