All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Yuho Choi <dbgh9129@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	David Ahern <dsahern@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] ipv6: route: Unregister netdevice notifier on BPF init failure
Date: Thu, 14 May 2026 18:42:59 -0700	[thread overview]
Message-ID: <20260514184259.3a852f9e@kernel.org> (raw)
In-Reply-To: <20260514002218.677943-1-dbgh9129@gmail.com>

On Wed, 13 May 2026 20:22:18 -0400 Yuho Choi wrote:
> ip6_route_init() registers ip6_route_dev_notifier before registering the
> IPv6 route BPF iterator target. If bpf_iter_register() fails, the error
> path jumps to out_register_late_subsys and unwinds the RTNL handlers and
> late pernet subsystem, but leaves the netdevice notifier registered.
> 
> Add a separate unwind label for the BPF iterator failure path so the
> netdevice notifier is unregistered before continuing with the existing
> cleanup.
> 
> Fixes: 138d0be35b14 ("net: bpf: Add netlink and ipv6_route bpf_iter targets")
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>

> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index cb521700cee7..4333e11dc9c5 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -6925,7 +6925,7 @@ int __init ip6_route_init(void)
>  #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_PROC_FS)
>  	ret = bpf_iter_register();
>  	if (ret)
> -		goto out_register_late_subsys;
> +		goto out_register_notifier;
>  #endif
>  #endif
>  
> @@ -6939,6 +6939,12 @@ int __init ip6_route_init(void)
>  out:
>  	return ret;
>  
> +#if IS_BUILTIN(CONFIG_IPV6)

Why this check?

> +#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_PROC_FS)
> +out_register_notifier:
> +	unregister_netdevice_notifier(&ip6_route_dev_notifier);
> +#endif
> +#endif
-- 
pw-bot: cr

      reply	other threads:[~2026-05-15  1:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14  0:22 [PATCH v1] ipv6: route: Unregister netdevice notifier on BPF init failure Yuho Choi
2026-05-15  1:42 ` Jakub Kicinski [this message]

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=20260514184259.3a852f9e@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dbgh9129@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.