From: Jakub Kicinski <kuba@kernel.org>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: netdev@vger.kernel.org, Cong Wang <cong.wang@bytedance.com>,
syzbot+21ba4d5adff0b6a7cfc6@syzkaller.appspotmail.com,
Kuniyuki Iwashima <kuniyu@amazon.com>
Subject: Re: [Patch net v2] rtnetlink: fix double call of rtnl_link_get_net_ifla()
Date: Sat, 30 Nov 2024 11:07:34 -0800 [thread overview]
Message-ID: <20241130110734.354f73d7@kernel.org> (raw)
In-Reply-To: <20241129212519.825567-1-xiyou.wangcong@gmail.com>
On Fri, 29 Nov 2024 13:25:19 -0800 Cong Wang wrote:
> From: Cong Wang <cong.wang@bytedance.com>
>
> Currently rtnl_link_get_net_ifla() gets called twice when we create
> peer devices, once in rtnl_add_peer_net() and once in each ->newlink()
> implementation.
>
> This looks safer, however, it leads to a classic Time-of-Check to
> Time-of-Use (TOCTOU) bug since IFLA_NET_NS_PID is very dynamic. And
> because of the lack of checking error pointer of the second call, it
> also leads to a kernel crash as reported by syzbot.
>
> Fix this by getting rid of the second call, which already becomes
> redudant after Kuniyuki's work. We have to propagate the result of the
> first rtnl_link_get_net_ifla() down to each ->newlink().
Two process notes:
- please wait 24h between postings;
- please don't post new versions in reply to an old one.
next prev parent reply other threads:[~2024-11-30 19:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-29 6:31 [Patch net] rtnetlink: catch error pointer for rtnl_link_get_net() Cong Wang
2024-11-29 7:36 ` Kuniyuki Iwashima
2024-11-29 17:21 ` Cong Wang
2024-11-29 21:25 ` [Patch net v2] rtnetlink: fix double call of rtnl_link_get_net_ifla() Cong Wang
2024-11-30 19:07 ` Jakub Kicinski [this message]
2024-12-02 1:51 ` Kuniyuki Iwashima
2024-12-03 10:40 ` patchwork-bot+netdevbpf
2024-12-16 10:24 ` Xiao Liang
2024-12-16 10:47 ` Kuniyuki Iwashima
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=20241130110734.354f73d7@kernel.org \
--to=kuba@kernel.org \
--cc=cong.wang@bytedance.com \
--cc=kuniyu@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=syzbot+21ba4d5adff0b6a7cfc6@syzkaller.appspotmail.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.