summaryrefslogtreecommitdiff
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@amazon.com>2025-04-17 17:03:49 -0700
committerPaolo Abeni <pabeni@redhat.com>2025-04-24 09:29:56 +0200
commitd27b9c40dbd66aa78b3e6657e600cf057a48ac1e (patch)
tree1423150bc6b5f6f2cd39649e8550928320c3ce55 /net/ipv6/route.c
parent5720a328c3e9802af48dd216c1c7eb0e91b61b6c (diff)
ipv6: Preallocate nhc_pcpu_rth_output in ip6_route_info_create().
ip6_route_info_create_nh() will be called under RCU. It calls fib_nh_common_init() and allocates nhc->nhc_pcpu_rth_output. As with the reason for rt->fib6_nh->rt6i_pcpu, we want to avoid GFP_ATOMIC allocation for nhc->nhc_pcpu_rth_output under RCU. Let's preallocate it in ip6_route_info_create(). Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Link: https://patch.msgid.link/20250418000443.43734-9-kuniyu@amazon.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1155cb017343..3037d1304388 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3732,10 +3732,19 @@ void fib6_nh_release_dsts(struct fib6_nh *fib6_nh)
static int fib6_nh_prealloc_percpu(struct fib6_nh *fib6_nh, gfp_t gfp_flags)
{
+ struct fib_nh_common *nhc = &fib6_nh->nh_common;
+
fib6_nh->rt6i_pcpu = alloc_percpu_gfp(struct rt6_info *, gfp_flags);
if (!fib6_nh->rt6i_pcpu)
return -ENOMEM;
+ nhc->nhc_pcpu_rth_output = alloc_percpu_gfp(struct rtable __rcu *,
+ gfp_flags);
+ if (!nhc->nhc_pcpu_rth_output) {
+ free_percpu(fib6_nh->rt6i_pcpu);
+ return -ENOMEM;
+ }
+
return 0;
}