]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bpf: Don't check sk_fullsock() in bpf_skc_to_unix_sock().
authorKuniyuki Iwashima <kuniyu@google.com>
Tue, 3 Feb 2026 21:30:07 +0000 (21:30 +0000)
committerMartin KaFai Lau <martin.lau@kernel.org>
Wed, 4 Feb 2026 17:36:06 +0000 (09:36 -0800)
AF_UNIX does not use TCP_NEW_SYN_RECV nor TCP_TIME_WAIT and
checking sk->sk_family is sufficient.

Let's remove sk_fullsock() and use sk_is_unix() in
bpf_skc_to_unix_sock().

Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20260203213442.682838-3-kuniyu@google.com
net/core/filter.c

index f04982d79d72e92f1b46ccd87633391e38c3da81..90bfe5a6c1db082c21f0878455031e6faa0a9824 100644 (file)
@@ -12021,7 +12021,7 @@ BPF_CALL_1(bpf_skc_to_unix_sock, struct sock *, sk)
         * trigger an explicit type generation here.
         */
        BTF_TYPE_EMIT(struct unix_sock);
-       if (sk && sk_fullsock(sk) && sk->sk_family == AF_UNIX)
+       if (sk && sk_is_unix(sk))
                return (unsigned long)sk;
 
        return (unsigned long)NULL;