Article View: linux.kernel.netdev
Article #21809Re: [PATCH] rtnetlink: fix NULL pointer dereference in rtnl_get_link()
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 13:58
Date: Tue, 24 Nov 2026 13:58
74 lines
10394 bytes
10394 bytes
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
Technical Details
Message-ID:
<179552872338.3135.1493919120916016303@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370400-linux-kernel-netdev=dewy.ruReferences:
<20261120134548.214126-1-mdshahid03@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370400-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] rtnetlink: fix NULL pointer dereference in rtnl_get_link() Date: Tue, 24 Nov 2026 13:58:43 +0000 Organization: Usenet Network Message-ID: <179552872338.3135.1493919120916016303@kernel.org> References: <20261120134548.214126-1-mdshahid03@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="4149091"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:eqhYnt062mkWN++0F6uJJ3P41jA= sha256:ImY+ZsoTLiLKeUES7RB1bG1zTSpe5dTovn8pNWCB2J8= sha1:pG6OJq5ECibKvN5/BXyl0qs0P4k= sha256:mf7N31bC1R/V6gVprZ6b1obuSmNCu1NuJStqFglaJEQ= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id C423C125E18; Tue, 24 Nov 2026 16:59:06 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FANuwq4673fj; Tue, 24 Nov 2026 16:58:59 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-370400-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id A293C125E16; Tue, 24 Nov 2026 16:58:47 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 8749833FA7; Tue, 24 Nov 2026 13:58:46 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795528726; b=B2iXnUIpwr7aEcVx5e8WHN2C1jEq/g0iVEU5pcc2mYrO0D1+yVcls7mj1HIRd3FC2dId M2fBLQn8XnjpTB1cTqJ7gS6RtgTzP1MWRlex1ZN1e+ZDztC4upZ11W67cv64qzUw+1rPe Uzpq0V+xY0Ao4ozIBhdUxhfOS2+SXkPS9qB6YFtrDbOzvhi4/eg47VDJBlpsDkDWIPlJ5 GVLH8j7FaHaH9CTSGsQRAWsKfbxVX+U4wQ4zCpR+QXdsiijZATtMfu5QBUxIX87jV50J/ +5U3MXRb9nlXto74i/tNrQdmqXYSyGa+YopnAQEUqu0A1wTDvfmjWhdDDsqQfqhz4tA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795528726; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=UWV/2wtSmri4o3sL0eBk9QAtoQv6kUUvklQ+1DmEMto=; b=t5bsDuOeooym3sw4DCBqa4RRRWkRjGXkP9vYHmyJrlDY/VKRA+HO70flt81tqqmiHdyx ornThmXvWwMGlGS3HfROQsX8/Nf4OYLE+DRw9kcqibX0kxZQvLGBcnLahik1SF+hlDkHk NO5hJv8zLw6O05fvaEMhpnEZEvRrs7M+vuiIUhkU4fshb1yPFmWSuTP+3imcmfvvyJ3CJ jpbk91ORkDpmpA6vuAM9dFHr/1/tAUeG7UOPQuLCtJ5qS216bhILpFuNtoForTrMsCktL ZHGPoTY7oQy8Dg14R2nCvwI3wII6SF18QT9gUjQYYtDCeNmvgbDy+zk7QCs+GT5DlTw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dlWMaQ10; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0073E606A331; Tue, 24 Nov 2026 13:58:46 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dlWMaQ10 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795528725; b=e0d0aAo3TBh+4/SvyjLqPu6Re79QCfg3I8uhsxzD3FvQKkRHcYM+QM99wDBrvgXGunyh qQfOJXJsm5c2dYhITC7FC98Svr9aHcW5CK5y6wkbO33zWRtmX7+pcpu9deFDYFpbBxO49 ICoGsThBAjArek8zVhRNraBQ6/f/Wmb92uE8bnrq2fcY3bSn43QN3OommIkuULEBhD1oR MQ085VAK8ZvVjk7/I6fqB7zsjqX/8EdZQ5HwE0OSnDNLr35g+iJS5G58gP9nPi/bz26SK 5cz6RHEvJ6uqb8MVPcivWannRsSOCOqTTcZuP+5H69pS3p9shomW0JzOU+yMgMT76rQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795528725; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=UWV/2wtSmri4o3sL0eBk9QAtoQv6kUUvklQ+1DmEMto=; b=sD8dw1hCyJXhD73bkmKAMTbVBFhRGVwiaEXksbLh6YmsYwH4rMf1aztdkGOFunQ+au62 LJROFeHZyKGb0OYdE0sl3wKfoMnFfiwuty135X+s6Shmnl9rMDrStxvYGGVtDqy+wxz9f G5S00yFCC4rRzt0g+r4ASFq/3AcytLiDevu0beaPImrUTks15cbyvM8wBbQWJfaHQp3r+ Sl7KowTAjLHODJPJiTz3jo6wfRjbi9SYpU0Z0Nno+rfXxDWxfwO2Mi8JbSiF04WBvHhN/ eZZnWqtTvTWgcPaZgc1XzJlOsrRWWbXkWkcT0WoIQnSo/oa9lNJyeX3HrE8V3h1xmhw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dlWMaQ10; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20C4B606A32C; Tue, 24 Nov 2026 13:58:44 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFF491F000C0; Tue, 24 Nov 2026 13:58:43 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795528724; bh=UWV/2wtSmri4o3sL0eBk9QAtoQv6kUUvklQ+1DmEMto=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=dlWMaQ10wlbTGUugt+naZw+NKoidgo0O2J7/km+IWB1cK3dvXlh0FnAlk6HAlhVep GSiP7huMz9AsrbrZGxqAdzxYJhqOuoBTrGKVhr9ulspjW+DH48zz5r+0G87BWWeHsB MymjlqFa3iKKZ1DIPLWOsTIKj9aYGzeaHVLp9frLZluCqOQ4w7jxBOTJPC4+IBoaYs YOJ+O3X5LU4k8AFn9yfImeeMJwLbwR67sZEZp5NBsVx6T6bsiraLursJAP2BurDtfc EdWWOluQD8hiePgIbXxAFgakvTJUn0ItlfE069e1hS0jIU2DTGHPwhrmgvvzhRAuQ6 KmsFXrnYFd26w== X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261120134548.214126-1-mdshahid03@gmail.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list