net: scm: move scm_detach_fds() from common path to scm_recv_unix()

scm->fp can only be set when using UNIX sockets, therefore we should
move it out of the common path __scm_recv_common() into
scm_recv_unix().

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Link: https://patch.msgid.link/20260813162818.149248-3-jkoolstra@xs4all.nl
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jori Koolstra
2026-08-13 12:28:16 -04:00
committed by Jakub Kicinski
parent de1c489b57
commit 48b84acc5e

View File

@@ -523,9 +523,6 @@ static bool __scm_recv_common(struct sock *sk, struct msghdr *msg,
scm_passec(sk, msg, scm);
if (scm->fp)
scm_detach_fds(msg, scm);
return true;
}
@@ -545,6 +542,9 @@ void scm_recv_unix(struct socket *sock, struct msghdr *msg,
if (!__scm_recv_common(sock->sk, msg, scm, flags))
return;
if (scm->fp)
scm_detach_fds(msg, scm);
if (sock->sk->sk_scm_pidfd)
scm_pidfd_recv(msg, scm);