netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Parkin <tparkin@katalix.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Sishuai Gong <sishuai@purdue.edu>,
	David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Matthias Schiffer <mschiffer@universe-factory.net>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: [PATCH v3] net: fix a concurrency bug in l2tp_tunnel_register()
Date: Mon, 26 Apr 2021 09:59:14 +0100	[thread overview]
Message-ID: <20210426085913.GA4750@katalix.com> (raw)
In-Reply-To: <CAM_iQpUV-rmGdn1g7jn==53wLQ0MvM_bx4cJBo4AEDVZXPehRQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1396 bytes --]

On  Fri, Apr 23, 2021 at 10:38:45 -0700, Cong Wang wrote:
> On Wed, Apr 21, 2021 at 12:25 PM Sishuai Gong <sishuai@purdue.edu> wrote:
> >
> > l2tp_tunnel_register() registers a tunnel without fully
> > initializing its attribute. This can allow another kernel thread
> > running l2tp_xmit_core() to access the uninitialized data and
> > then cause a kernel NULL pointer dereference error, as shown below.
> >
> > Thread 1    Thread 2
> > //l2tp_tunnel_register()
> > list_add_rcu(&tunnel->list, &pn->l2tp_tunnel_list);
> >             //pppol2tp_connect()
> >             tunnel = l2tp_tunnel_get(sock_net(sk), info.tunnel_id);
> >             // Fetch the new tunnel
> >             ...
> >             //l2tp_xmit_core()
> >             struct sock *sk = tunnel->sock;
> >             ...
> >             bh_lock_sock(sk);
> >             //Null pointer error happens
> > tunnel->sock = sk;
> >
> > Fix this bug by initializing tunnel->sock before adding the
> > tunnel into l2tp_tunnel_list.
> >
> > Signed-off-by: Sishuai Gong <sishuai@purdue.edu>
> > Reported-by: Sishuai Gong <sishuai@purdue.edu>
> 
> Reviewed-by: Cong Wang <cong.wang@bytedance.com>
> 
> Thanks.

For some reason I've not been seeing these patches, just the replies.
I can't see it on lore.kernel.org either, unless I'm missing something
obvious.

Have the original mails cc'd netdev?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-04-26  8:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210421192430.3036-1-sishuai@purdue.edu>
2021-04-23 17:38 ` [PATCH v3] net: fix a concurrency bug in l2tp_tunnel_register() Cong Wang
2021-04-26  8:59   ` Tom Parkin [this message]
     [not found]     ` <E30A6022-C479-4F67-B945-BFF0472CE320@purdue.edu>
2021-04-27  8:54       ` Tom Parkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210426085913.GA4750@katalix.com \
    --to=tparkin@katalix.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=mschiffer@universe-factory.net \
    --cc=netdev@vger.kernel.org \
    --cc=sishuai@purdue.edu \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).