diff options
author | Kyle Evans <kevans@FreeBSD.org> | 2020-12-15 21:54:31 +0000 |
---|---|---|
committer | Kyle Evans <kevans@FreeBSD.org> | 2020-12-15 21:54:31 +0000 |
commit | 3f3bc560b30289cb146161120d4d128238410c77 (patch) | |
tree | bf4ecae6a1c37127097a317bb1a672ed435d0050 | |
parent | ca8c198afa5450fe25e6e9ab56fa195d74953baa (diff) | |
download | src-test2-3f3bc560b30289cb146161120d4d128238410c77.tar.gz src-test2-3f3bc560b30289cb146161120d4d128238410c77.zip |
MFC r368326: kern: soclose: don't sleep on SO_LINGER w/ timeout=0
This is a valid scenario that's handled in the various protocol layers where
it makes sense (e.g., tcp_disconnect and sctp_disconnect). Given that it
indicates we should immediately drop the connection, it makes little sense
to sleep on it.
This could lead to panics with INVARIANTS. On non-INVARIANTS kernels, this
could result in the thread hanging until a signal interrupts it if the
protocol does not mark the socket as disconnected for whatever reason.
Notes
Notes:
svn path=/stable/12/; revision=368683
-rw-r--r-- | sys/kern/uipc_socket.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index a8140378ce1d..ba03de4c32fe 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1090,7 +1090,8 @@ soclose(struct socket *so) goto drop; } } - if (so->so_options & SO_LINGER) { + + if ((so->so_options & SO_LINGER) != 0 && so->so_linger != 0) { if ((so->so_state & SS_ISDISCONNECTING) && (so->so_state & SS_NBIO)) goto drop; |