Netdev List
 help / color / mirror / Atom feed
* [PATCH] phonet: check register_netdevice_notifier() error in phonet_device_init()
@ 2026-07-13  7:52 Minhong He
  2026-07-13 19:22 ` Rémi Denis-Courmont
  0 siblings, 1 reply; 2+ messages in thread
From: Minhong He @ 2026-07-13  7:52 UTC (permalink / raw)
  To: netdev; +Cc: Remi Denis-Courmont

phonet_device_init() registers a netdevice notifier before calling
phonet_netlink_register(), but does not check whether notifier
registration succeeded. On failure, netlink setup still proceeds and
init may return success without the notifier in place.

Check the notifier registration error and unwind through
phonet_device_exit() on failure.

Signed-off-by: Minhong He <heminhong@kylinos.cn>
---
 net/phonet/pn_dev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index ad44831d6745..0445f7ef0320 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -356,7 +356,11 @@ int __init phonet_device_init(void)
 
 	proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
 			sizeof(struct seq_net_private));
-	register_netdevice_notifier(&phonet_device_notifier);
+	err = register_netdevice_notifier(&phonet_device_notifier);
+	if (err) {
+		phonet_device_exit();
+		return err;
+	}
 	err = phonet_netlink_register();
 	if (err)
 		phonet_device_exit();
-- 
2.25.1


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

end of thread, other threads:[~2026-07-14 17:31 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:52 [PATCH] phonet: check register_netdevice_notifier() error in phonet_device_init() Minhong He
2026-07-13 19:22 ` Rémi Denis-Courmont

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