From: Minhong He <heminhong@kylinos.cn>
To: David Ahern <dsahern@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH net] net: vrf: check register_netdevice_notifier() error in vrf_init_module()
Date: Mon, 3 Aug 2026 17:00:02 +0800 [thread overview]
Message-ID: <20260803090002.142453-1-heminhong@kylinos.cn> (raw)
vrf_init_module() ignores register_netdevice_notifier() errors and
continues module initialization, which can leave VRF loaded without its
netdev notifier registered.
Check the error and fail module initialization early.
Signed-off-by: Minhong He <heminhong@kylinos.cn>
---
drivers/net/vrf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 46209917ae4d..a0557a3a7026 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -1932,7 +1932,9 @@ static int __init vrf_init_module(void)
{
int rc;
- register_netdevice_notifier(&vrf_notifier_block);
+ rc = register_netdevice_notifier(&vrf_notifier_block);
+ if (rc < 0)
+ return rc;
rc = register_pernet_subsys(&vrf_net_ops);
if (rc < 0)
--
2.25.1
next reply other threads:[~2026-08-03 9:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 9:00 Minhong He [this message]
2026-08-03 16:59 ` [PATCH net] net: vrf: check register_netdevice_notifier() error in vrf_init_module() David Ahern
2026-08-05 1:55 ` Jakub Kicinski
2026-08-05 2:08 ` David Ahern
2026-08-05 2:00 ` 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=20260803090002.142453-1-heminhong@kylinos.cn \
--to=heminhong@kylinos.cn \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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