[PATCH net] net: lapbether: check register_netdevice_notifier() error in lapbeth_init_driver()

Minhong He posted 1 patch 1 month, 4 weeks ago
drivers/net/wan/lapbether.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
[PATCH net] net: lapbether: check register_netdevice_notifier() error in lapbeth_init_driver()
Posted by Minhong He 1 month, 4 weeks ago
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.

Signed-off-by: Minhong He <heminhong@kylinos.cn>
---
 drivers/net/wan/lapbether.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index 9861c99ea56c..c3630a82913b 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -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);
 
-- 
2.25.1
RE: [PATCH net] net: lapbether: check register_netdevice_notifier() error in lapbeth_init_driver()
Posted by Jagielski, Jedrzej 1 month, 4 weeks ago
From: Minhong He <heminhong@kylinos.cn> 
Sent: Monday, August 3, 2026 11:00 AM

>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.
>
>Signed-off-by: Minhong He <heminhong@kylinos.cn>


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