net/sysctl: Rename kvfree_rcu() to kvfree_rcu_mightsleep()
authorUladzislau Rezki (Sony) <urezki@gmail.com>
Wed, 1 Feb 2023 15:08:12 +0000 (16:08 +0100)
committerJoel Fernandes (Google) <joel@joelfernandes.org>
Wed, 5 Apr 2023 13:48:04 +0000 (13:48 +0000)
The kfree_rcu() and kvfree_rcu() macros' single-argument forms are
deprecated.  Therefore switch to the new kfree_rcu_mightsleep() and
kvfree_rcu_mightsleep() variants. The goal is to avoid accidental use
of the single-argument forms, which can introduce functionality bugs in
atomic contexts and latency bugs in non-atomic contexts.

Acked-by: Jakub Kicinski <kuba@kernel.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
net/core/sysctl_net_core.c

index 74842b453407015a735118f4a06a77be47bcfafb..782273bb93c23c10b733dd6a1100f309acdb67f9 100644 (file)
@@ -177,7 +177,7 @@ static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
                        if (orig_sock_table) {
                                static_branch_dec(&rps_needed);
                                static_branch_dec(&rfs_needed);
-                               kvfree_rcu(orig_sock_table);
+                               kvfree_rcu_mightsleep(orig_sock_table);
                        }
                }
        }
@@ -215,7 +215,7 @@ static int flow_limit_cpu_sysctl(struct ctl_table *table, int write,
                                     lockdep_is_held(&flow_limit_update_mutex));
                        if (cur && !cpumask_test_cpu(i, mask)) {
                                RCU_INIT_POINTER(sd->flow_limit, NULL);
-                               kfree_rcu(cur);
+                               kfree_rcu_mightsleep(cur);
                        } else if (!cur && cpumask_test_cpu(i, mask)) {
                                cur = kzalloc_node(len, GFP_KERNEL,
                                                   cpu_to_node(i));