Re: [PATCH net] net: bonding: check register_netdevice_notifier() error in bonding_init()
Jay Vosburgh <[email protected]> Mon, 03 Aug 2026 10:32:03 -0700
| Newsgroups | org.kernel.vger.netdev,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <3479489.1785778323@famine> |
Minhong He <[email protected]> wrote: >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. > >Signed-off-by: Minhong He <[email protected]> It appears that the matching unregister_netdevice_notifier call in bonding_exit has the same issue, although there's probably not much that could be done there other than printing a message. Regardless: Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Acked-by: Jay Vosburgh <[email protected]> -J >--- > 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 e1bec8164221..3405a20bd498 100644 >--- a/drivers/net/bonding/bond_main.c >+++ b/drivers/net/bonding/bond_main.c >@@ -6637,7 +6637,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: >-- >2.25.1 --- -Jay Vosburgh, [email protected]