All of lore.kernel.org
 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

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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.