We will remove synchronize_rcu() in udp_tunnel_sock_release().
We must ensure that vxlan_sock is freed after inflight RX fast path.
Let's free vxlan_sock with kfree_rcu().
Note that vxlan_sock.vni_list[] is 8K and struct rcu_head must
be placed before it.
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260502031401.3557229-9-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
if (__vxlan_sock_release_prep(sock4)) {
udp_tunnel_sock_release(sock4->sk);
- kfree(sock4);
+ kfree_rcu(sock4, rcu);
}
#if IS_ENABLED(CONFIG_IPV6)
if (__vxlan_sock_release_prep(sock6)) {
udp_tunnel_sock_release(sock6->sk);
- kfree(sock6);
+ kfree_rcu(sock6, rcu);
}
#endif
}
struct vxlan_sock {
struct hlist_node hlist;
struct sock *sk;
+ struct rcu_head rcu;
struct hlist_head vni_list[VNI_HASH_SIZE];
refcount_t refcnt;
u32 flags;