aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Stewart <rrs@FreeBSD.org>2010-06-05 21:17:23 +0000
committerRandall Stewart <rrs@FreeBSD.org>2010-06-05 21:17:23 +0000
commit62fb761ff28bb184a2543e539dd689fefd5d3246 (patch)
treea8a312f938dcff7bd975de5b5e53db2d48149ed4
parent54b2e8ad078aa52b377ec7c575ac57badcfb62af (diff)
downloadsrc-62fb761ff28bb184a2543e539dd689fefd5d3246.tar.gz
src-62fb761ff28bb184a2543e539dd689fefd5d3246.zip
This fixes a bug in the close up of a socket that
had un-accepted assoc's. Basically the assoc (and inp) would get stuck and never get cleaned up. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=208852
-rw-r--r--sys/netinet/sctp_pcb.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c
index a89573ab9981..cccd8c503196 100644
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -3164,8 +3164,17 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from)
nasoc = LIST_NEXT(asoc, sctp_tcblist);
if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
/* Skip guys being freed */
- /* asoc->sctp_socket = NULL; FIXME MT */
cnt_in_sd++;
+ if (asoc->asoc.state & SCTP_STATE_IN_ACCEPT_QUEUE) {
+ /*
+ * Special case - we did not start a
+ * kill timer on the asoc due to it
+ * was not closed. So go ahead and
+ * start it now.
+ */
+ asoc->asoc.state &= ~SCTP_STATE_IN_ACCEPT_QUEUE;
+ sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, asoc, NULL);
+ }
SCTP_TCB_UNLOCK(asoc);
continue;
}
@@ -4590,8 +4599,12 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
* Someone holds a reference OR the socket is unaccepted
* yet.
*/
- if (stcb->asoc.refcnt)
+ if ((stcb->asoc.refcnt) ||
+ (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
+ (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
+ stcb->asoc.state &= ~SCTP_STATE_IN_ACCEPT_QUEUE;
sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL);
+ }
SCTP_TCB_UNLOCK(stcb);
if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE))