svn commit: r322856 - head/sys/kern
Gleb Smirnoff
glebius at FreeBSD.org
Thu Aug 24 20:49:20 UTC 2017
Author: glebius
Date: Thu Aug 24 20:49:19 2017
New Revision: 322856
URL: https://svnweb.freebsd.org/changeset/base/322856
Log:
Third take on the r319685 and r320480. Actually allow for call soisconnected()
via soisdisconnected(), and in the earlier unlock earlier to avoid lock
recursion.
This fixes a situation when a socket on accept queue is reset before being
accepted.
Reported by: Jason Eggleston <jeggleston llnw.com>
Modified:
head/sys/kern/uipc_sockbuf.c
head/sys/kern/uipc_socket.c
Modified: head/sys/kern/uipc_sockbuf.c
==============================================================================
--- head/sys/kern/uipc_sockbuf.c Thu Aug 24 20:19:27 2017 (r322855)
+++ head/sys/kern/uipc_sockbuf.c Thu Aug 24 20:49:19 2017 (r322856)
@@ -334,7 +334,7 @@ sowakeup(struct socket *so, struct sockbuf *sb)
if (sb->sb_flags & SB_AIO)
sowakeup_aio(so, sb);
SOCKBUF_UNLOCK(sb);
- if (ret == SU_ISCONNECTED && !(so->so_state & SS_ISDISCONNECTED))
+ if (ret == SU_ISCONNECTED)
soisconnected(so);
if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL)
pgsigio(&so->so_sigio, SIGIO, 0);
Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c Thu Aug 24 20:19:27 2017 (r322855)
+++ head/sys/kern/uipc_socket.c Thu Aug 24 20:49:19 2017 (r322856)
@@ -3769,13 +3769,14 @@ soisdisconnected(struct socket *so)
so->so_state |= SS_ISDISCONNECTED;
if (!SOLISTENING(so)) {
+ SOCK_UNLOCK(so);
SOCKBUF_LOCK(&so->so_rcv);
socantrcvmore_locked(so);
SOCKBUF_LOCK(&so->so_snd);
sbdrop_locked(&so->so_snd, sbused(&so->so_snd));
socantsendmore_locked(so);
- }
- SOCK_UNLOCK(so);
+ } else
+ SOCK_UNLOCK(so);
wakeup(&so->so_timeo);
}
More information about the svn-src-all
mailing list