mirror-linux/net/unix
Kuniyuki Iwashima 6884028cd7 af_unix: Fix memleak of newsk in unix_stream_connect().
When prepare_peercred() fails in unix_stream_connect(),
unix_release_sock() is not called for newsk, and the memory
is leaked.

Let's move prepare_peercred() before unix_create1().

Fixes: fd0a109a0f ("net, pidfs: prepare for handing out pidfds for reaped sk->sk_peer_pid")
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260207232236.2557549-1-kuniyu@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-02-11 13:01:13 +01:00
..
Kconfig af_unix: Add a prompt to CONFIG_AF_UNIX_OOB 2024-12-19 19:16:15 -08:00
Makefile af_unix: Remove CONFIG_UNIX_SCM. 2024-01-31 16:41:16 -08:00
af_unix.c af_unix: Fix memleak of newsk in unix_stream_connect(). 2026-02-11 13:01:13 +01:00
af_unix.h af_unix: Consolidate unix_schedule_gc() and wait_for_unix_gc(). 2025-11-18 19:19:32 -08:00
diag.c net: remove sock_i_uid() 2025-06-23 17:04:03 -07:00
garbage.c af_unix: annotate unix_gc_lock with __cacheline_aligned_in_smp 2025-12-08 23:43:24 -08:00
sysctl_net_unix.c af_unix: Clean up #include under net/unix/. 2025-03-25 04:30:07 -07:00
unix_bpf.c af_unix: Explicitly include headers for non-pointer struct fields. 2025-03-25 04:30:07 -07:00