net: vrf: check register_netdevice_notifier() error in vrf_init_module()

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.

This is a future looking check, register_netdevice_notifier()
only fails on double registration or if the registered notifier
itself returns an error.

Signed-off-by: Minhong He <heminhong@kylinos.cn>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20260803090002.142453-1-heminhong@kylinos.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Minhong He 2026-08-03 17:00:02 +08:00 committed by Jakub Kicinski
parent 82167f2f0f
commit ac072a89cb

View File

@ -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)