Date: Tue, 15 Dec 2020 21:54:31 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r368683 - stable/12/sys/kern Message-ID: <202012152154.0BFLsVXt053477@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012152154.0BFLsVXt053477>