Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: ipvlan: check register_netdevice_notifier() error in ipvlan_init_module()
@ 2026-08-03  9:00 Minhong He
  2026-08-05  1:57 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Minhong He @ 2026-08-03  9:00 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev
  Cc: Dmitry Skorodumov, Kees Cook, linux-kernel

ipvlan_init_module() ignores register_netdevice_notifier() errors and
continues module initialization, which can leave ipvlan loaded without
its netdev notifier registered.

Check the error and fail module initialization early.

Signed-off-by: Minhong He <heminhong@kylinos.cn>
---
 drivers/net/ipvlan/ipvlan_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index ed46439a9f4e..518c7b97deaa 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -1048,7 +1048,9 @@ static int __init ipvlan_init_module(void)
 	int err;
 
 	ipvlan_init_secret();
-	register_netdevice_notifier(&ipvlan_notifier_block);
+	err = register_netdevice_notifier(&ipvlan_notifier_block);
+	if (err)
+		return err;
 #if IS_ENABLED(CONFIG_IPV6)
 	register_inet6addr_notifier(&ipvlan_addr6_notifier_block);
 	register_inet6addr_validator_notifier(
-- 
2.25.1


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

* Re: [PATCH net] net: ipvlan: check register_netdevice_notifier() error in ipvlan_init_module()
  2026-08-03  9:00 [PATCH net] net: ipvlan: check register_netdevice_notifier() error in ipvlan_init_module() Minhong He
@ 2026-08-05  1:57 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2026-08-05  1:57 UTC (permalink / raw)
  To: Minhong He
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni, netdev,
	Dmitry Skorodumov, Kees Cook, linux-kernel

On Mon,  3 Aug 2026 17:00:07 +0800 Minhong He wrote:
> -	register_netdevice_notifier(&ipvlan_notifier_block);
> +	err = register_netdevice_notifier(&ipvlan_notifier_block);
> +	if (err)
> +		return err;
>  #if IS_ENABLED(CONFIG_IPV6)
>  	register_inet6addr_notifier(&ipvlan_addr6_notifier_block);
>  	register_inet6addr_validator_notifier(

You should error check these as well while at it?

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

end of thread, other threads:[~2026-08-05  1:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03  9:00 [PATCH net] net: ipvlan: check register_netdevice_notifier() error in ipvlan_init_module() Minhong He
2026-08-05  1:57 ` Jakub Kicinski

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