From: Jakub Kicinski <kuba@kernel.org>
To: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: <cratiu@nvidia.com>, <davem@davemloft.net>, <edumazet@google.com>,
<horms@kernel.org>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>, <pabeni@redhat.com>, <sdf@fomichev.me>,
<syzbot+de1c7d68a10e3f123bdd@syzkaller.appspotmail.com>,
<syzkaller-bugs@googlegroups.com>
Subject: Re: [syzbot] [net?] general protection fault in rtnl_create_link
Date: Mon, 14 Apr 2025 11:15:36 -0700 [thread overview]
Message-ID: <20250414111536.6d6493f1@kernel.org> (raw)
In-Reply-To: <20250414180257.24176-1-kuniyu@amazon.com>
On Mon, 14 Apr 2025 11:01:59 -0700 Kuniyuki Iwashima wrote:
> From: Jakub Kicinski <kuba@kernel.org>
> Date: Mon, 14 Apr 2025 10:37:27 -0700
> > On Sun, 13 Apr 2025 19:30:46 -0700 Kuniyuki Iwashima wrote:
> > > diff --git a/include/net/netdev_lock.h b/include/net/netdev_lock.h
> > > index 5706835a660c..270e157a4a79 100644
> > > --- a/include/net/netdev_lock.h
> > > +++ b/include/net/netdev_lock.h
> > > @@ -30,7 +30,8 @@ static inline bool netdev_need_ops_lock(const struct net_device *dev)
> > > bool ret = dev->request_ops_lock || !!dev->queue_mgmt_ops;
> > >
> > > #if IS_ENABLED(CONFIG_NET_SHAPER)
> > > - ret |= !!dev->netdev_ops->net_shaper_ops;
> > > + if (dev->netdev_ops)
> > > + ret |= !!dev->netdev_ops->net_shaper_ops;
> > > #endif
> >
> > This is a bit surprising, we pretty much never validate if dev has ops.
> >
> > I think we're guaranteed that IFF_UP will not be set if we just
> > allocated the device, so we can remove the locks in rtnl_create_link()
> > and to double confirm add a netdev_ops_assert_locked_or_invisible()
> > in netif_state_change() ?
>
> Removing the lock from NEWLINK makes sense, but my concern
> was NETDEV_CHANGE, which will requires more caution ?
>
> commit 04efcee6ef8d0f01eef495db047e7216d6e6e38f
> Author: Stanislav Fomichev <sdf@fomichev.me>
> Date: Fri Apr 4 09:11:22 2025 -0700
>
> net: hold instance lock during NETDEV_CHANGE
How could we fire a notifier for a device that hasn't been initialized,
let alone registered?
I'm hoping that the _or_invisible assert in my suggestion will flag to
future developers trying to change netif_state_change() that the device
here may not be fully constructed.
next prev parent reply other threads:[~2025-04-14 18:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-14 2:14 [syzbot] [net?] general protection fault in rtnl_create_link syzbot
2025-04-14 2:30 ` Kuniyuki Iwashima
2025-04-14 3:07 ` syzbot
2025-04-14 17:37 ` Jakub Kicinski
2025-04-14 18:01 ` Kuniyuki Iwashima
2025-04-14 18:15 ` Jakub Kicinski [this message]
2025-04-14 18:23 ` 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=20250414111536.6d6493f1@kernel.org \
--to=kuba@kernel.org \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuniyu@amazon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=syzbot+de1c7d68a10e3f123bdd@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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).