net: bonding: check register_netdevice_notifier() error in bonding_init()

bonding_init() ignores register_netdevice_notifier() errors and still
returns success, which can leave the bonding module loaded without its
netdev notifier registered.

Check the error and unwind prior initialization on failure.

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>
Acked-by: Jay Vosburgh <jv@jvosburgh.net>
Link: https://patch.msgid.link/20260803090012.142638-1-heminhong@kylinos.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Minhong He 2026-08-03 17:00:12 +08:00 committed by Jakub Kicinski
parent ac072a89cb
commit b16bab3258

View File

@ -6638,7 +6638,9 @@ static int __init bonding_init(void)
flow_keys_bonding_keys,
ARRAY_SIZE(flow_keys_bonding_keys));
register_netdevice_notifier(&bond_netdev_notifier);
res = register_netdevice_notifier(&bond_netdev_notifier);
if (res)
goto err;
out:
return res;
err: