From: netdev-bot+sashiko@kernel.org
To: mdshahid03@gmail.com
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtnetlink: fix NULL pointer dereference in rtnl_get_link()
Date: Tue, 24 Nov 2026 13:58:43 +0000 [thread overview]
Message-ID: <179552872338.3135.1493919120916016303@kernel.org> (raw)
In-Reply-To: <20261120134548.214126-1-mdshahid03@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The commit message describes a crash that cannot happen.
--
rtnetlink: fix NULL pointer dereference in rtnl_get_link()
This patch adds a NULL check in rtnl_get_link(). The check covers the case
where the PF_UNSPEC fallback handler table is also NULL, so the function
returns NULL instead of dereferencing tab[msgtype].
> However, the fallback table can also be NULL,for example
> after rtnl_unregister_all(PF_UNSPEC) clears it.
>
> In that cass, dereferencing tab[msgtyp] results in a NULL
> pointer dereference.
[Severity: Medium]
Can rtnl_msg_handlers[PF_UNSPEC] actually become NULL at runtime? Nothing
in the tree seems to call rtnl_unregister_all(PF_UNSPEC). Its callers all
pass a specific family:
net/can/gw.c: rtnl_unregister_all(PF_CAN);
net/ipv6/addrconf.c: rtnl_unregister_all(PF_INET6);
net/ipv6/af_inet6.c: rtnl_unregister_all(PF_INET6);
net/ipv6/route.c: rtnl_unregister_all(PF_INET6);
net/mpls/af_mpls.c: rtnl_unregister_all(PF_MPLS);
net/phonet/pn_dev.c: rtnl_unregister_all(PF_PHONET);
The PF_UNSPEC table is allocated at boot in the __init function
rtnetlink_init():
rtnl_register_many(rtnetlink_rtnl_msg_handlers);
Nothing frees that table afterwards.
Modules that remove PF_UNSPEC handlers do it through
rtnl_unregister()/rtnl_unregister_many(). Those only clear individual slots:
net/core/rtnetlink.c:rtnl_unregister() {
...
link = rcu_replace_pointer_rtnl(tab[msgindex], NULL);
...
}
They never set rtnl_msg_handlers[PF_UNSPEC] to NULL.
The callers in rtnetlink_rcv_msg() already handle a NULL link:
link = rtnl_get_link(family, type);
if (!link || !link->doit) {
So the new check looks like harmless defensive code, not a fix for a crash
anyone can reach. Could the commit message say that, or show the real
trigger, with a reproducer or oops trace if there is one? As written, the
subject and body read like a reachable NULL dereference fix, and stable
backport tooling might pick it up as one.
There are also some typos: "cass" should be "case", "msgtyp" should be
"msgtype", and "NULL,for" is missing a space.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120134548.214126-1-mdshahid03%40gmail.com
prev parent reply other threads:[~2026-11-24 13:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 13:45 [PATCH] rtnetlink: fix NULL pointer dereference in rtnl_get_link() mdshahid03
2026-11-20 13:49 ` netdev-bot+sinfo
2026-11-20 18:04 ` Jakub Kicinski
2026-11-21 11:10 ` mdshahid03
2026-11-23 10:56 ` Paolo Abeni
2026-11-23 16:01 ` mdshahid03
2026-11-23 18:01 ` Eric Dumazet
2026-11-24 8:56 ` Paolo Abeni
2026-11-24 13:34 ` mdshahid03
2026-11-24 13:58 ` netdev-bot+sashiko [this message]
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=179552872338.3135.1493919120916016303@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mdshahid03@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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