From b16bab325801c7be004222cad0ae296aa5982e79 Mon Sep 17 00:00:00 2001 From: Minhong He Date: Mon, 3 Aug 2026 17:00:12 +0800 Subject: [PATCH] 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 Acked-by: Jay Vosburgh Link: https://patch.msgid.link/20260803090012.142638-1-heminhong@kylinos.cn Signed-off-by: Jakub Kicinski --- drivers/net/bonding/bond_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index a925577c8253..ef9eb0c53c66 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -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: