Netdev List
 help / color / mirror / Atom feed
* [PATCH net v3] mctp: check register_netdevice_notifier() error in mctp_device_init()
@ 2026-07-20  7:25 Minhong He
  2026-07-23 17:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Minhong He @ 2026-07-20  7:25 UTC (permalink / raw)
  To: jk, matt, davem, edumazet, kuba, pabeni, horms, kuniyu; +Cc: heminhong, netdev

mctp_device_init() handles errors from rtnl_af_register() and
rtnl_register_many(), but ignores the return value of
register_netdevice_notifier(). If notifier registration fails, init can
still return success while the module is only partially initialized.

Check the notifier registration error and fail module init early.

Fixes: 583be982d934 ("mctp: Add device handling and netlink interface")
Signed-off-by: Minhong He <heminhong@kylinos.cn>
---
v3:
- Correct Fixes tag to 583be982d934 (bug predates d51705614f66).
- No Cc:stable (unlikely init failure path; stable would also need
  d51705614f66 as a prereq on older trees).
v2: https://lore.kernel.org/netdev/20260716063534.116793-1-heminhong@kylinos.cn/
v1: https://lore.kernel.org/netdev/20260713073918.419422-1-heminhong@kylinos.cn/

 net/mctp/device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/mctp/device.c b/net/mctp/device.c
index 2c84df674669..822120e860c8 100644
--- a/net/mctp/device.c
+++ b/net/mctp/device.c
@@ -536,7 +536,9 @@ int __init mctp_device_init(void)
 {
 	int err;
 
-	register_netdevice_notifier(&mctp_dev_nb);
+	err = register_netdevice_notifier(&mctp_dev_nb);
+	if (err)
+		return err;
 
 	err = rtnl_af_register(&mctp_af_ops);
 	if (err)
-- 
2.25.1


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

* Re: [PATCH net v3] mctp: check register_netdevice_notifier() error in mctp_device_init()
  2026-07-20  7:25 [PATCH net v3] mctp: check register_netdevice_notifier() error in mctp_device_init() Minhong He
@ 2026-07-23 17:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-07-23 17:10 UTC (permalink / raw)
  To: Minhong He; +Cc: jk, matt, davem, edumazet, kuba, pabeni, horms, kuniyu, netdev

Hello:

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

On Mon, 20 Jul 2026 15:25:18 +0800 you wrote:
> mctp_device_init() handles errors from rtnl_af_register() and
> rtnl_register_many(), but ignores the return value of
> register_netdevice_notifier(). If notifier registration fails, init can
> still return success while the module is only partially initialized.
> 
> Check the notifier registration error and fail module init early.
> 
> [...]

Here is the summary with links:
  - [net,v3] mctp: check register_netdevice_notifier() error in mctp_device_init()
    https://git.kernel.org/netdev/net/c/d9a33cadc70a

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] 2+ messages in thread

end of thread, other threads:[~2026-07-23 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20  7:25 [PATCH net v3] mctp: check register_netdevice_notifier() error in mctp_device_init() Minhong He
2026-07-23 17: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