Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: bonding: check register_netdevice_notifier() error in bonding_init()
@ 2026-08-03  9:00 Minhong He
  2026-08-03 17:32 ` Jay Vosburgh
  2026-08-05  2:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Minhong He @ 2026-08-03  9:00 UTC (permalink / raw)
  To: Jay Vosburgh, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev
  Cc: linux-kernel

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 <heminhong@kylinos.cn>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: bonding: check register_netdevice_notifier() error in bonding_init()
  2026-08-03  9:00 [PATCH net] net: bonding: check register_netdevice_notifier() error in bonding_init() Minhong He
@ 2026-08-03 17:32 ` Jay Vosburgh
  2026-08-05  2:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jay Vosburgh @ 2026-08-03 17:32 UTC (permalink / raw)
  To: Minhong He
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev, linux-kernel

Minhong He <heminhong@kylinos.cn> 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 <heminhong@kylinos.cn>

	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 <jv@jvosburgh.net>

	-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, jv@jvosburgh.net

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: bonding: check register_netdevice_notifier() error in bonding_init()
  2026-08-03  9:00 [PATCH net] net: bonding: check register_netdevice_notifier() error in bonding_init() Minhong He
  2026-08-03 17:32 ` Jay Vosburgh
@ 2026-08-05  2:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-05  2:10 UTC (permalink / raw)
  To: Minhong He
  Cc: jv, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon,  3 Aug 2026 17:00:12 +0800 you 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 <heminhong@kylinos.cn>
> 
> [...]

Here is the summary with links:
  - [net] net: bonding: check register_netdevice_notifier() error in bonding_init()
    https://git.kernel.org/netdev/net-next/c/b16bab325801

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-05  2:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03  9:00 [PATCH net] net: bonding: check register_netdevice_notifier() error in bonding_init() Minhong He
2026-08-03 17:32 ` Jay Vosburgh
2026-08-05  2:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox