[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <667b7932-9d8b-c793-38ba-78554b56cebd@katalix.com>
Date: Fri, 23 Aug 2024 08:13:50 +0100
From: James Chapman <jchapman@...alix.com>
To: Cong Wang <xiyou.wangcong@...il.com>, netdev@...r.kernel.org
Cc: Cong Wang <cong.wang@...edance.com>,
syzbot+8dbe3133b840c470da0e@...kaller.appspotmail.com,
Tom Parkin <tparkin@...alix.com>
Subject: Re: [Patch net-next] l2tp: avoid overriding sk->sk_user_data
On 22/08/2024 19:25, Cong Wang wrote:
> From: Cong Wang <cong.wang@...edance.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@...kaller.appspotmail.com
> Cc: James Chapman <jchapman@...alix.com>
> Cc: Tom Parkin <tparkin@...alix.com>
> Signed-off-by: Cong Wang <cong.wang@...edance.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@...alix.com>
Reviewed-by: James Chapman <jchapman@...alix.com>
Powered by blists - more mailing lists