]> www.infradead.org Git - users/jedix/linux-maple.git/commit
af_unix: Set sk_peer_pid/sk_peer_cred locklessly for new socket.
authorKuniyuki Iwashima <kuniyu@amazon.com>
Thu, 20 Jun 2024 20:56:21 +0000 (13:56 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 25 Jun 2024 09:10:18 +0000 (11:10 +0200)
commitfaf489e6896d645a679d3d90a2d1d5d12c6b3e13
treeaaf95bbcdcfddab81bbec0a7dbc52aa62460e9be
parent8647ece4814f3bfdb5f7a8e19f882c9b89299a07
af_unix: Set sk_peer_pid/sk_peer_cred locklessly for new socket.

init_peercred() is called in 3 places:

  1. socketpair() : both sockets
  2. connect()    : child socket
  3. listen()     : listening socket

The first two need not hold sk_peer_lock because no one can
touch the socket.

Let's set cred/pid without holding lock for the two cases and
rename the old init_peercred() to update_peercred() to properly
reflect the use case.

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/unix/af_unix.c