Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: unix: remove outdated BSD behavior comment in unix_release_sock()

Remove the long-standing comment in unix_release_sock() that described a
behavioral difference between Linux and BSD regarding when ECONNRESET is
sent to connected UNIX sockets upon closure.

As confirmed by testing on macOS (similar to BSD behavior), ECONNRESET
is only observed for SOCK_DGRAM sockets, not for SOCK_STREAM. Meanwhile,
Linux already returns ECONNRESET in cases where a socket is closed with
unread data or is not yet accept()ed. This means the previous comment no
longer accurately describes current behavior and is misleading.

Suggested-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Sunday Adelodun <adelodunolaoluwa@yahoo.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20251021195906.20389-1-adelodunolaoluwa@yahoo.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Sunday Adelodun and committed by
Jakub Kicinski
ec538867 99ad2b68

-11
-11
net/unix/af_unix.c
··· 733 733 734 734 /* ---- Socket is dead now and most probably destroyed ---- */ 735 735 736 - /* 737 - * Fixme: BSD difference: In BSD all sockets connected to us get 738 - * ECONNRESET and we die on the spot. In Linux we behave 739 - * like files and pipes do and wait for the last 740 - * dereference. 741 - * 742 - * Can't we simply set sock->err? 743 - * 744 - * What the above comment does talk about? --ANK(980817) 745 - */ 746 - 747 736 if (READ_ONCE(unix_tot_inflight)) 748 737 unix_gc(); /* Garbage collect fds */ 749 738 }