Skip to contentSkip to conversation

net: lapbether: check register_netdevice_notifier() error in lapbeth_init_driver()

PATCH Applied Minhong He 3 participants 3 messages Aug 3 – Aug 5

Subsystems (3)
lore
Share & tools
lore

Minhong He

author
#0 lore raw

PATCH 1/1 net: lapbether: check register_netdevice_notifier() error in lapbeth_init_driver()

lapbeth_init_driver() ignores register_netdevice_notifier() errors and always returns success, which can leave the module loaded without its netdev notifier registered.

Check the error and remove the packet type on failure.

---
 drivers/net/wan/lapbether.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wan/lapbether.c +7 -1
index 9861c99ea56c..c3630a82913b 100644
@@ -497,9 +497,15 @@ static const char banner[] __initconst =
 
 static int __init lapbeth_init_driver(void)
 {
+	int err;
+
 	dev_add_pack(&lapbeth_packet_type);
 
-	register_netdevice_notifier(&lapbeth_dev_notifier);
+	err = register_netdevice_notifier(&lapbeth_dev_notifier);
+	if (err) {
+		dev_remove_pack(&lapbeth_packet_type);
+		return err;
+	}
 
 	printk(banner);
 
Signature · 1 line
2.25.1
#1 lore raw

From: Minhong He <[email protected]>
Sent: Monday, August 3, 2026 11:00 AM

Quoted 7 lines

lapbeth_init_driver() ignores register_netdevice_notifier() errors and always returns success, which can leave the module loaded without its netdev notifier registered.

Check the error and remove the packet type on failure.

Hi Minhong

why do not gather all the patches into single series, all of them seem to be doing similar things. that could help to deal with them in more organized way

I believe also fixes tags might be missing

#2 lore raw
In reply to Minhong He
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Mon, 3 Aug 2026 16:59:36 +0800 you wrote:

lapbeth_init_driver() ignores register_netdevice_notifier() errors and always returns success, which can leave the module loaded without its netdev notifier registered.

Check the error and remove the packet type on failure.

[...]

Here is the summary with links:
- [net] net: lapbether: check register_netdevice_notifier() error in lapbeth_init_driver()

    https://git.kernel.org/netdev/net-next/c/e43e9d7cabac

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html