[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <68262d4ab643_25ebe529488@willemb.c.googlers.com.notmuch>
Date: Thu, 15 May 2025 14:07:06 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Willem de Bruijn <willemb@...gle.com>
Cc: Simon Horman <horms@...nel.org>,
Christian Brauner <brauner@...nel.org>,
Kuniyuki Iwashima <kuniyu@...zon.com>,
Kuniyuki Iwashima <kuni1840@...il.com>,
netdev@...r.kernel.org
Subject: Re: [PATCH v3 net-next 1/9] af_unix: Factorise test_bit() for
SOCK_PASSCRED and SOCK_PASSPIDFD.
Kuniyuki Iwashima wrote:
> Currently, the same checks for SOCK_PASSCRED and SOCK_PASSPIDFD
> are scattered across many places.
>
> Let's centralise the bit tests to make the following changes cleaner.
>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
> net/unix/af_unix.c | 37 +++++++++++++++----------------------
> 1 file changed, 15 insertions(+), 22 deletions(-)
>
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 2ab20821d6bb..464e183ffdb8 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -765,6 +765,14 @@ static void copy_peercred(struct sock *sk, struct sock *peersk)
> spin_unlock(&sk->sk_peer_lock);
> }
>
> +static bool unix_may_passcred(const struct sock *sk)
> +{
> + struct socket *sock = sk->sk_socket;
Also const?
> +
> + return test_bit(SOCK_PASSCRED, &sock->flags) ||
> + test_bit(SOCK_PASSPIDFD, &sock->flags);
> +}
Powered by blists - more mailing lists