From: Minhong He <heminhong@kylinos.cn>
To: Martin Schiller <ms@dev.tdt.de>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-x25@vger.kernel.org, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH net] net: lapbether: check register_netdevice_notifier() error in lapbeth_init_driver()
Date: Mon, 3 Aug 2026 16:59:36 +0800 [thread overview]
Message-ID: <20260803085936.142160-1-heminhong@kylinos.cn> (raw)
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
next reply other threads:[~2026-08-03 8:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 8:59 Minhong He [this message]
2026-08-03 11:23 ` [PATCH net] net: lapbether: check register_netdevice_notifier() error in lapbeth_init_driver() Jagielski, Jedrzej
2026-08-05 2:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260803085936.142160-1-heminhong@kylinos.cn \
--to=heminhong@kylinos.cn \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-x25@vger.kernel.org \
--cc=ms@dev.tdt.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox