]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
soreuseport: Clear sk_reuseport_cb before failure in sk_clone().
authorKuniyuki Iwashima <kuniyu@google.com>
Thu, 9 Jul 2026 18:31:39 +0000 (18:31 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 21 Jul 2026 16:14:59 +0000 (09:14 -0700)
commit98da8ce87dd561f08fbe44f75865edc5d9b2ba5f
tree872adf30e27242f3cfacb3d79b416af47c234496
parent4bf22afe53a1de4b44b04cf677fd5199089cbdff
soreuseport: Clear sk_reuseport_cb before failure in sk_clone().

When sk_clone() fails, sk_destruct() is called for the new socket.

If the parent socket has sk->sk_reuseport_cb, the child will call
reuseport_detach_sock() for the reuseport group.

Let's clear sk->sk_reuseport_cb before any failure path in sk_clone().

Note that this was not a problem before the cited commit because
reuseport_detach_sock() did nothing if the socket was not found in
the reuseport array.

Fixes: 5dc4c4b7d4e8 ("bpf: Introduce BPF_MAP_TYPE_REUSEPORT_SOCKARRAY")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/20260709032007.9E4D61F000E9@smtp.kernel.org/
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260709183315.965751-2-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/sock.c