Re: [PATCH net] net: vrf: check register_netdevice_notifier() error in vrf_init_module()

David Ahern <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.network
Message-ID <[email protected]>
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 <[email protected]>
> ---
>  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 <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.