From: Stanislav Fomichev <stfomichev@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, eric.dumazet@gmail.com,
syzbot+9fc858ba0312b42b577e@syzkaller.appspotmail.com,
Stanislav Fomichev <sdf@fomichev.me>
Subject: Re: [PATCH net] net: prevent a NULL deref in rtnl_create_link()
Date: Wed, 4 Jun 2025 08:41:59 -0700 [thread overview]
Message-ID: <aEBpR7eUHIqH0EvE@mini-arch> (raw)
In-Reply-To: <20250604105815.1516973-1-edumazet@google.com>
On 06/04, Eric Dumazet wrote:
> At the time rtnl_create_link() is running, dev->netdev_ops is NULL,
> we must not use netdev_lock_ops() or risk a NULL deref if
> CONFIG_NET_SHAPER is defined.
>
> Use netif_set_group() instead of dev_set_group().
>
> RIP: 0010:netdev_need_ops_lock include/net/netdev_lock.h:33 [inline]
> RIP: 0010:netdev_lock_ops include/net/netdev_lock.h:41 [inline]
> RIP: 0010:dev_set_group+0xc0/0x230 net/core/dev_api.c:82
> Call Trace:
> <TASK>
> rtnl_create_link+0x748/0xd10 net/core/rtnetlink.c:3674
> rtnl_newlink_create+0x25c/0xb00 net/core/rtnetlink.c:3813
> __rtnl_newlink net/core/rtnetlink.c:3940 [inline]
> rtnl_newlink+0x16d6/0x1c70 net/core/rtnetlink.c:4055
> rtnetlink_rcv_msg+0x7cf/0xb70 net/core/rtnetlink.c:6944
> netlink_rcv_skb+0x208/0x470 net/netlink/af_netlink.c:2534
> netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline]
> netlink_unicast+0x75b/0x8d0 net/netlink/af_netlink.c:1339
> netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1883
> sock_sendmsg_nosec net/socket.c:712 [inline]
>
> Reported-by: syzbot+9fc858ba0312b42b577e@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/netdev/6840265f.a00a0220.d4325.0009.GAE@google.com/T/#u
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Fixes: 7e4d784f5810 ("net: hold netdev instance lock during rtnetlink operations")
> Cc: Stanislav Fomichev <sdf@fomichev.me>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
next prev parent reply other threads:[~2025-06-04 15:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-04 10:58 [PATCH net] net: prevent a NULL deref in rtnl_create_link() Eric Dumazet
2025-06-04 15:41 ` Stanislav Fomichev [this message]
2025-06-05 15:20 ` 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=aEBpR7eUHIqH0EvE@mini-arch \
--to=stfomichev@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=syzbot+9fc858ba0312b42b577e@syzkaller.appspotmail.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