Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: vrf: check register_netdevice_notifier() error in vrf_init_module()
@ 2026-08-03  9:00 Minhong He
  2026-08-03 16:59 ` David Ahern
  2026-08-05  2:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Minhong He @ 2026-08-03  9:00 UTC (permalink / raw)
  To: David Ahern, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev
  Cc: linux-kernel

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

Check the error and fail module initialization early.

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

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 46209917ae4d..a0557a3a7026 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -1932,7 +1932,9 @@ static int __init vrf_init_module(void)
 {
 	int rc;
 
-	register_netdevice_notifier(&vrf_notifier_block);
+	rc = register_netdevice_notifier(&vrf_notifier_block);
+	if (rc < 0)
+		return rc;
 
 	rc = register_pernet_subsys(&vrf_net_ops);
 	if (rc < 0)
-- 
2.25.1


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

* Re: [PATCH net] net: vrf: check register_netdevice_notifier() error in vrf_init_module()
  2026-08-03  9:00 [PATCH net] net: vrf: check register_netdevice_notifier() error in vrf_init_module() Minhong He
@ 2026-08-03 16:59 ` David Ahern
  2026-08-05  1:55   ` Jakub Kicinski
  2026-08-05  2:00 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: David Ahern @ 2026-08-03 16:59 UTC (permalink / raw)
  To: Minhong He, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev
  Cc: linux-kernel

On 8/3/26 3:00 AM, Minhong He wrote:
> vrf_init_module() ignores register_netdevice_notifier() errors and
> continues module initialization, which can leave VRF loaded without its
> netdev notifier registered.
> 
> Check the error and fail module initialization early.
> 

Fixes: 193125dbd8eb ("net: Introduce VRF device driver")

> Signed-off-by: Minhong He <heminhong@kylinos.cn>
> ---
>  drivers/net/vrf.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
> index 46209917ae4d..a0557a3a7026 100644
> --- a/drivers/net/vrf.c
> +++ b/drivers/net/vrf.c
> @@ -1932,7 +1932,9 @@ static int __init vrf_init_module(void)
>  {
>  	int rc;
>  
> -	register_netdevice_notifier(&vrf_notifier_block);
> +	rc = register_netdevice_notifier(&vrf_notifier_block);
> +	if (rc < 0)
> +		return rc;
>  
>  	rc = register_pernet_subsys(&vrf_net_ops);
>  	if (rc < 0)

Reviewed-by: David Ahern <dsahern@kernel.org>


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

* Re: [PATCH net] net: vrf: check register_netdevice_notifier() error in vrf_init_module()
  2026-08-03 16:59 ` David Ahern
@ 2026-08-05  1:55   ` Jakub Kicinski
  2026-08-05  2:08     ` David Ahern
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2026-08-05  1:55 UTC (permalink / raw)
  To: David Ahern
  Cc: Minhong He, Andrew Lunn, David S. Miller, Eric Dumazet,
	Paolo Abeni, netdev, linux-kernel

On Mon, 3 Aug 2026 10:59:47 -0600 David Ahern wrote:
> Fixes: 193125dbd8eb ("net: Introduce VRF device driver")

Thanks for the tag and the review!

In this case I'm going to skip and take this via net-next
'cause register_netdevice_notifier() is guaranteed not
to fail today.

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

* Re: [PATCH net] net: vrf: check register_netdevice_notifier() error in vrf_init_module()
  2026-08-03  9:00 [PATCH net] net: vrf: check register_netdevice_notifier() error in vrf_init_module() Minhong He
  2026-08-03 16:59 ` David Ahern
@ 2026-08-05  2:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-05  2:00 UTC (permalink / raw)
  To: Minhong He
  Cc: dsahern, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon,  3 Aug 2026 17:00:02 +0800 you wrote:
> vrf_init_module() ignores register_netdevice_notifier() errors and
> continues module initialization, which can leave VRF loaded without its
> netdev notifier registered.
> 
> Check the error and fail module initialization early.
> 
> Signed-off-by: Minhong He <heminhong@kylinos.cn>
> 
> [...]

Here is the summary with links:
  - [net] net: vrf: check register_netdevice_notifier() error in vrf_init_module()
    https://git.kernel.org/netdev/net-next/c/ac072a89cba2

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH net] net: vrf: check register_netdevice_notifier() error in vrf_init_module()
  2026-08-05  1:55   ` Jakub Kicinski
@ 2026-08-05  2:08     ` David Ahern
  0 siblings, 0 replies; 5+ messages in thread
From: David Ahern @ 2026-08-05  2:08 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Minhong He, Andrew Lunn, David S. Miller, Eric Dumazet,
	Paolo Abeni, netdev, linux-kernel

On 8/4/26 7:55 PM, Jakub Kicinski wrote:
> In this case I'm going to skip and take this via net-next
> 'cause register_netdevice_notifier() is guaranteed not
> to fail today.

considered that response, so it works for me.

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03  9:00 [PATCH net] net: vrf: check register_netdevice_notifier() error in vrf_init_module() Minhong He
2026-08-03 16:59 ` David Ahern
2026-08-05  1:55   ` Jakub Kicinski
2026-08-05  2:08     ` David Ahern
2026-08-05  2:00 ` patchwork-bot+netdevbpf

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