Netdev List
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Minhong He <heminhong@kylinos.cn>,
	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>,
	netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: vrf: check register_netdevice_notifier() error in vrf_init_module()
Date: Mon, 3 Aug 2026 10:59:47 -0600	[thread overview]
Message-ID: <f8b967f3-238e-4402-89a3-95d8ac0bbe3f@kernel.org> (raw)
In-Reply-To: <20260803090002.142453-1-heminhong@kylinos.cn>

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>


  reply	other threads:[~2026-08-03 16:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-08-05  1:55   ` Jakub Kicinski
2026-08-05  2:08     ` David Ahern
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=f8b967f3-238e-4402-89a3-95d8ac0bbe3f@kernel.org \
    --to=dsahern@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=heminhong@kylinos.cn \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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