Thread (5 messages) read the whole thread 5 messages, 3 authors, 15d ago

Re: [PATCH net v2] mctp: check register_netdevice_notifier() error in mctp_device_init()

From: Kuniyuki Iwashima <kuniyu@google.com>
Date: 2026-07-16 07:32:54

On Thu, Jul 16, 2026 at 8:35 AM Minhong He [off-list ref] 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.

Fixes: d51705614f66 ("mctp: Handle error of rtnl_register_module().")
The bug predates the commit:

$ git blame -L:mctp_device_init net/mctp/device.c d51705614f668~


quoted hunk ↗ jump to hunk
Signed-off-by: Minhong He <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help