svn commit: r368683 - stable/12/sys/kern

Kyle Evans kevans at FreeBSD.org
Tue Dec 15 21:54:32 UTC 2020


Author: kevans
Date: Tue Dec 15 21:54:31 2020
New Revision: 368683
URL: https://svnweb.freebsd.org/changeset/base/368683

Log:
  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.

Modified:
  stable/12/sys/kern/uipc_socket.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/uipc_socket.c
==============================================================================
--- stable/12/sys/kern/uipc_socket.c	Tue Dec 15 21:53:54 2020	(r368682)
+++ stable/12/sys/kern/uipc_socket.c	Tue Dec 15 21:54:31 2020	(r368683)
@@ -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;


More information about the svn-src-stable mailing list