From: Guillaume Nault <gnault@redhat.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: netdev@vger.kernel.org, saeed@kernel.org, tparkin@katalix.com,
Cong Wang <cong.wang@bytedance.com>,
syzbot+52866e24647f9a23403f@syzkaller.appspotmail.com,
syzbot+94cc2a66fc228b23f360@syzkaller.appspotmail.com,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Jakub Sitnicki <jakub@cloudflare.com>,
Eric Dumazet <edumazet@google.com>
Subject: Re: [Patch net v3 2/2] l2tp: close all race conditions in l2tp_tunnel_register()
Date: Mon, 16 Jan 2023 12:08:22 +0100 [thread overview]
Message-ID: <Y8UwJkRY1ISej+Zu@debian> (raw)
In-Reply-To: <20230114030137.672706-3-xiyou.wangcong@gmail.com>
On Fri, Jan 13, 2023 at 07:01:37PM -0800, Cong Wang wrote:
> From: Cong Wang <cong.wang@bytedance.com>
>
> The code in l2tp_tunnel_register() is racy in several ways:
>
> 1. It modifies the tunnel socket _after_ publishing it.
>
> 2. It calls setup_udp_tunnel_sock() on an existing socket without
> locking.
>
> 3. It changes sock lock class on fly, which triggers many syzbot
> reports.
>
> This patch amends all of them by moving socket initialization code
> before publishing and under sock lock. As suggested by Jakub, the
> l2tp lockdep class is not necessary as we can just switch to
> bh_lock_sock_nested().
Reviewed-by: Guillaume Nault <gnault@redhat.com>
next prev parent reply other threads:[~2023-01-16 11:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-14 3:01 [Patch net v3 0/2] l2tp: fix race conditions in l2tp_tunnel_register() Cong Wang
2023-01-14 3:01 ` [Patch net v3 1/2] l2tp: convert l2tp_tunnel_list to idr Cong Wang
2023-01-16 11:07 ` Guillaume Nault
2023-01-14 3:01 ` [Patch net v3 2/2] l2tp: close all race conditions in l2tp_tunnel_register() Cong Wang
2023-01-16 11:08 ` Guillaume Nault [this message]
2023-01-17 8:08 ` Eric Dumazet
2023-01-17 8:10 ` Eric Dumazet
2023-01-17 10:57 ` Guillaume Nault
2023-01-16 11:38 ` [Patch net v3 0/2] l2tp: fix " Tom Parkin
2023-01-16 13:50 ` patchwork-bot+netdevbpf
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=Y8UwJkRY1ISej+Zu@debian \
--to=gnault@redhat.com \
--cc=cong.wang@bytedance.com \
--cc=edumazet@google.com \
--cc=jakub@cloudflare.com \
--cc=netdev@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=saeed@kernel.org \
--cc=syzbot+52866e24647f9a23403f@syzkaller.appspotmail.com \
--cc=syzbot+94cc2a66fc228b23f360@syzkaller.appspotmail.com \
--cc=tparkin@katalix.com \
--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 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.