mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
vxlan: Free vxlan_sock with kfree_rcu().
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>
This commit is contained in:
committed by
Jakub Kicinski
parent
027bffa1ad
commit
4f71dd1b42
@@ -1524,13 +1524,13 @@ static void vxlan_sock_release(struct vxlan_dev *vxlan)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -186,6 +186,7 @@ struct vxlan_metadata {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user