[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220708200602.1059bc09@kernel.org>
Date: Fri, 8 Jul 2022 20:06:02 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Hawkins Jiawei <yin31149@...il.com>
Cc: syzbot+5f26f85569bd179c18ce@...kaller.appspotmail.com,
andrii@...nel.org, ast@...nel.org, borisp@...dia.com,
bpf@...r.kernel.org, daniel@...earbox.net, davem@...emloft.net,
edumazet@...gle.com, guwen@...ux.alibaba.com,
yoshfuji@...ux-ipv6.org, dsahern@...nel.org,
john.fastabend@...il.com, kafai@...com, kgraul@...ux.ibm.com,
kpsingh@...nel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, pabeni@...hat.com, songliubraving@...com,
syzkaller-bugs@...glegroups.com, yhs@...com,
skhan@...uxfoundation.org, 18801353760@....com,
paskripkin@...il.com,
linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH] smc: fix refcount bug in sk_psock_get (2)
On Sat, 9 Jul 2022 10:46:59 +0800 Hawkins Jiawei wrote:
> Reported-and-tested-by: syzbot+5f26f85569bd179c18ce@...kaller.appspotmail.com
> Signed-off-by: hawk <18801353760@....com>
> ---
> net/ipv4/tcp.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 9984d23a7f3e..a1e6cab2c748 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -3395,10 +3395,23 @@ static int do_tcp_setsockopt(struct sock *sk, int level, int optname,
> }
> case TCP_ULP: {
> char name[TCP_ULP_NAME_MAX];
> + struct sock *smc_sock;
>
> if (optlen < 1)
> return -EINVAL;
>
> + /* SMC sk_user_data may be treated as psock,
> + * which triggers a refcnt warning.
> + */
> + rcu_read_lock();
> + smc_sock = rcu_dereference_sk_user_data(sk);
> + if (level == SOL_TCP && smc_sock &&
> + smc_sock->__sk_common.skc_family == AF_SMC) {
This should prolly be under the socket lock?
Can we add a bit to SK_USER_DATA_PTRMASK and have ULP-compatible
users (sockmap) opt into ULP cooperation? Modifying TCP is backwards,
layer-wise.
> + rcu_read_unlock();
> + return -EOPNOTSUPP;
> + }
> + rcu_read_unlock();
> +
Powered by blists - more mailing lists