[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpVbDm-P6czt+8m_79w78L0czdN-nk5JzvrBpUR=C09Bcw@mail.gmail.com>
Date: Mon, 12 Apr 2021 12:09:10 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Karsten Graul <kgraul@...ux.ibm.com>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
linux-s390@...r.kernel.org, Cong Wang <cong.wang@...edance.com>,
syzbot <syzbot+b54a1ce86ba4a623b7f0@...kaller.appspotmail.com>,
John Fastabend <john.fastabend@...il.com>
Subject: Re: [Patch net] smc: disallow TCP_ULP in smc_setsockopt()
On Sun, Apr 11, 2021 at 11:52 PM Karsten Graul <kgraul@...ux.ibm.com> wrote:
>
>
>
> On 10/04/2021 20:17, Cong Wang wrote:
> > From: Cong Wang <cong.wang@...edance.com>
> >
> > syzbot is able to setup kTLS on an SMC socket, which coincidentally
> > uses sk_user_data too, later, kTLS treats it as psock so triggers a
> > refcnt warning. The cause is that smc_setsockopt() simply calls
> > TCP setsockopt(). I do not think it makes sense to setup kTLS on
> > top of SMC, so we can just disallow this.
> >
> > Reported-and-tested-by: syzbot+b54a1ce86ba4a623b7f0@...kaller.appspotmail.com
> > Cc: John Fastabend <john.fastabend@...il.com>
> > Cc: Karsten Graul <kgraul@...ux.ibm.com>
> > Signed-off-by: Cong Wang <cong.wang@...edance.com>
> > ---
> > net/smc/af_smc.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> > index 47340b3b514f..0d4d6d28f20c 100644
> > --- a/net/smc/af_smc.c
> > +++ b/net/smc/af_smc.c
> > @@ -2162,6 +2162,9 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
> > struct smc_sock *smc;
> > int val, rc;
> >
> > + if (optname == TCP_ULP)
> > + return -EOPNOTSUPP;
> > +
> > smc = smc_sk(sk);
> >
> > /* generic setsockopts reaching us here always apply to the
> > @@ -2186,7 +2189,6 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
> > if (rc || smc->use_fallback)
> > goto out;
> > switch (optname) {
> > - case TCP_ULP:
>
> Should'nt it return -EOPNOTSUPP in that case, too?
I do not think I understand this. In case of TCP_ULP, we will
not even reach this switch case after my patch.
Thanks.
Powered by blists - more mailing lists