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

Kyle Evans <[email protected]> Tue, 15 Dec 2020 21:54:31 +0000 (UTC)
Newsgroups gmane.os.freebsd.devel.cvs
Message-ID <202012152154.0BFLsVXt053477__38034.2750506074$1608069278$gmane$org@repo.freebsd.org>
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;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"