]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ipv4: fib: Call fib_proc_exit() and nl_fib_lookup_exit() at ->pre_exit().
authorKuniyuki Iwashima <kuniyu@google.com>
Fri, 12 Jun 2026 06:32:05 +0000 (06:32 +0000)
committerJakub Kicinski <kuba@kernel.org>
Mon, 15 Jun 2026 18:49:28 +0000 (11:49 -0700)
We will call ip_fib_net_exit() from ->exit_rtnl().

Since the exit callbacks are called in the following order,

  1. ->pre_exit()
  ~~~ synchronize_rcu() ~~~
  2. ->exit_rtnl()   : ip_fib_net_exit()
  3. ->exit()        : fib_proc_exit() / nl_fib_lookup_exit()
  4. ->exit_batch()  : fib4_semantics_exit()

the reverse order of fib_net_init() would get messed up.

Let's move fib_proc_exit() and nl_fib_lookup_exit() to ->pre_exit().

This is fine because procfs/netlink access from userspace cannot
occur at this point and synchronize_rcu() is not needed.

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260612063225.455191-3-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/fib_frontend.c

index ceeb87b13b93a4d912d9b0687c5fc4c28b483eee..3b1bd53c7357fe14b2e5cf161dd5063e84bdb82c 100644 (file)
@@ -1656,7 +1656,7 @@ out_semantics:
        goto out;
 }
 
-static void __net_exit fib_net_exit(struct net *net)
+static void __net_exit fib_net_pre_exit(struct net *net)
 {
        fib_proc_exit(net);
        nl_fib_lookup_exit(net);
@@ -1680,7 +1680,7 @@ static void __net_exit fib_net_exit_batch(struct list_head *net_list)
 
 static struct pernet_operations fib_net_ops = {
        .init = fib_net_init,
-       .exit = fib_net_exit,
+       .pre_exit = fib_net_pre_exit,
        .exit_batch = fib_net_exit_batch,
 };