linux/net/unix
Kuniyuki Iwashima 22e5751b05 af_unix: Don't use spin_lock_nested() in copy_peercred().
When (AF_UNIX, SOCK_STREAM) socket connect()s to a listening socket,
the listener's sk_peer_pid/sk_peer_cred are copied to the client in
copy_peercred().

Then, two sk_peer_locks are held there; one is client's and another
is listener's.

However, the latter is not needed because we hold the listner's
unix_state_lock() there and unix_listen() cannot update the cred
concurrently.

Let's drop the unnecessary spin_lock() and use the bare spin_lock()
for the client to protect concurrent read by getsockopt(SO_PEERCRED).

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-06-25 11:10:19 +02:00
..
af_unix.c af_unix: Don't use spin_lock_nested() in copy_peercred(). 2024-06-25 11:10:19 +02:00
diag.c af_unix: Remove U_LOCK_DIAG. 2024-06-25 11:10:18 +02:00
garbage.c af_unix: Define locking order for U_RECVQ_LOCK_EMBRYO in unix_collect_skb(). 2024-06-25 11:10:18 +02:00
Kconfig af_unix: Remove CONFIG_UNIX_SCM. 2024-01-31 16:41:16 -08:00
Makefile af_unix: Remove CONFIG_UNIX_SCM. 2024-01-31 16:41:16 -08:00
sysctl_net_unix.c net: Remove the now superfluous sentinel elements from ctl_table array 2024-05-03 13:29:41 +01:00
unix_bpf.c bpf: sockmap, fix proto update hook to avoid dup calls 2024-01-03 16:50:06 -08:00