]> git.hungrycats.org Git - linux/commit
vxlan: Store struct sock in struct vxlan_sock.
authorKuniyuki Iwashima <kuniyu@google.com>
Sat, 2 May 2026 03:13:00 +0000 (03:13 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 6 May 2026 00:47:04 +0000 (17:47 -0700)
commit027bffa1ad19f5da59ee7923464dd248b0a9930f
tree1acc81610e900ab154d58e10549eccaee9b72406
parent30a45c0bffdd62350261e2f2689fdba426a33578
vxlan: Store struct sock in struct vxlan_sock.

Commit 3cf7203ca620 ("net/tunnel: wait until all sk_user_data
reader finish before releasing the sock") added synchronize_rcu()
in udp_tunnel_sock_release().

This was intended to protect the fast path of a dying vxlan device
from dereferencing vxlan_sock->sock->sk after sock_orphan() has set
sock->sk to NULL.

However, vxlan does not need to access struct socket itself in the
fast path; it only reads struct sock, and struct socket is only
used for tunnel setup and teardown.

Let's store struct sock directly in struct vxlan_sock.

In the next patch, we will free vxlan_sock with kfree_rcu(), then
vxlan no longer needs synchronize_rcu() in udp_tunnel_sock_release().

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260502031401.3557229-8-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/vxlan/vxlan_core.c
drivers/net/vxlan/vxlan_multicast.c
include/net/vxlan.h