* [PATCH v2] ipv6: route: Unregister netdevice notifier on BPF init failure
@ 2026-05-15 13:05 Yuho Choi
2026-05-19 0:14 ` Jakub Kicinski
0 siblings, 1 reply; 4+ messages in thread
From: Yuho Choi @ 2026-05-15 13:05 UTC (permalink / raw)
To: David S. Miller, David Ahern, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: Simon Horman, netdev, linux-kernel, Yuho Choi
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.
Unregister the netdevice notifier in the bpf_iter_register() failure
branch before continuing with the existing cleanup path.
Fixes: 138d0be35b14 ("net: bpf: Add netlink and ipv6_route bpf_iter targets")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
Chages since v1:
- Unregister ip6_route_dev_notifier directlry in the bpf_iter_register() failure path.
net/ipv6/route.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index cb521700cee7..de9a1d4c72d8 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -6924,8 +6924,10 @@ int __init ip6_route_init(void)
#if IS_BUILTIN(CONFIG_IPV6)
#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_PROC_FS)
ret = bpf_iter_register();
- if (ret)
+ if (ret) {
+ unregister_netdevice_notifier(&ip6_route_dev_notifier);
goto out_register_late_subsys;
+ }
#endif
#endif
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] ipv6: route: Unregister netdevice notifier on BPF init failure
2026-05-15 13:05 [PATCH v2] ipv6: route: Unregister netdevice notifier on BPF init failure Yuho Choi
@ 2026-05-19 0:14 ` Jakub Kicinski
2026-05-19 13:49 ` 최유호
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2026-05-19 0:14 UTC (permalink / raw)
To: Yuho Choi
Cc: David S. Miller, David Ahern, Eric Dumazet, Paolo Abeni,
Simon Horman, netdev, linux-kernel
On Fri, 15 May 2026 09:05:17 -0400 Yuho Choi wrote:
> Chages since v1:
> - Unregister ip6_route_dev_notifier directlry in the bpf_iter_register() failure path.
The goto was fine.
You're generating the patch against an old version of the source code.
Please use
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
Or for networking fixes better still:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
--
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] ipv6: route: Unregister netdevice notifier on BPF init failure
2026-05-19 0:14 ` Jakub Kicinski
@ 2026-05-19 13:49 ` 최유호
2026-05-19 23:31 ` Jakub Kicinski
0 siblings, 1 reply; 4+ messages in thread
From: 최유호 @ 2026-05-19 13:49 UTC (permalink / raw)
To: Jakub Kicinski
Cc: David S. Miller, David Ahern, Eric Dumazet, Paolo Abeni,
Simon Horman, netdev, linux-kernel
Dear Jakub,
Thanks for pointing out the outdated tree. I will definitely rebase
and resubmit v3 against netdev/net.git.
Regarding the goto: The reason I moved away from the goto approach in
v2 is that if CONFIG_BPF_SYSCALL and CONFIG_PROC_FS are disabled, the
goto statement is compiled out. This leaves the target label unused,
triggering an "unused-label" compiler warning.
Since guarding labels with #ifdefs can get messy, I opted for the
direct unregistration in the failure path for v2 to keep it clean.
Would you still prefer I use the goto and guard the label
appropriately in v3, or is direct unregistration acceptable given the
warning?
Best regards,
Yuho
On Mon, 18 May 2026 at 20:14, Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Fri, 15 May 2026 09:05:17 -0400 Yuho Choi wrote:
> > Chages since v1:
> > - Unregister ip6_route_dev_notifier directlry in the bpf_iter_register() failure path.
>
> The goto was fine.
> You're generating the patch against an old version of the source code.
> Please use
> https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
>
> Or for networking fixes better still:
> https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
> --
> pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] ipv6: route: Unregister netdevice notifier on BPF init failure
2026-05-19 13:49 ` 최유호
@ 2026-05-19 23:31 ` Jakub Kicinski
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-05-19 23:31 UTC (permalink / raw)
To: 최유호
Cc: David S. Miller, David Ahern, Eric Dumazet, Paolo Abeni,
Simon Horman, netdev, linux-kernel
On Tue, 19 May 2026 09:49:04 -0400 최유호 wrote:
> Thanks for pointing out the outdated tree. I will definitely rebase
> and resubmit v3 against netdev/net.git.
>
> Regarding the goto: The reason I moved away from the goto approach in
> v2 is that if CONFIG_BPF_SYSCALL and CONFIG_PROC_FS are disabled, the
> goto statement is compiled out. This leaves the target label unused,
> triggering an "unused-label" compiler warning.
>
> Since guarding labels with #ifdefs can get messy, I opted for the
> direct unregistration in the failure path for v2 to keep it clean.
>
> Would you still prefer I use the goto and guard the label
> appropriately in v3, or is direct unregistration acceptable given the
> warning?
Yes, guard the label, please.
Reminder: please don't top post.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-19 23:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-15 13:05 [PATCH v2] ipv6: route: Unregister netdevice notifier on BPF init failure Yuho Choi
2026-05-19 0:14 ` Jakub Kicinski
2026-05-19 13:49 ` 최유호
2026-05-19 23:31 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox