Netdev List
 help / color / mirror / Atom feed
* [PATCH] mctp: check register_netdevice_notifier() error in mctp_device_init()
@ 2026-07-13  7:39 Minhong He
  2026-07-15  0:37 ` Jeremy Kerr
  0 siblings, 1 reply; 2+ messages in thread
From: Minhong He @ 2026-07-13  7:39 UTC (permalink / raw)
  To: netdev; +Cc: Jeremy Kerr, Matt Johnston

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: d51705614f66 ("mctp: Handle error of rtnl_register_module().")

Signed-off-by: Minhong He <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] mctp: check register_netdevice_notifier() error in mctp_device_init()
  2026-07-13  7:39 [PATCH] mctp: check register_netdevice_notifier() error in mctp_device_init() Minhong He
@ 2026-07-15  0:37 ` Jeremy Kerr
  0 siblings, 0 replies; 2+ messages in thread
From: Jeremy Kerr @ 2026-07-15  0:37 UTC (permalink / raw)
  To: Minhong He, netdev; +Cc: Matt Johnston

Hi,

> [PATCH] mctp: check register_netdevice_notifier() error in mctp_device_init()

Please include the target tree in the subject prefix. SInce this is for
the net tree, you want something like:

  [PATCH net] mctp: check ...

> 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.

The change itself looks good, thanks.

> Fixes: d51705614f66 ("mctp: Handle error of rtnl_register_module().")

... but no newline between the fixes and signed-off-by (and other tags).

Also, make sure you CC all the necessary maintainers; you're getting a
nipa CI failure due to that.

With those addressed:

Acked-by: Jeremy Kerr <jk@codeconstruct.com.au>

Cheers,


Jeremy

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

end of thread, other threads:[~2026-07-15  0:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13  7:39 [PATCH] mctp: check register_netdevice_notifier() error in mctp_device_init() Minhong He
2026-07-15  0:37 ` Jeremy Kerr

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