summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2010-06-05 21:17:23 +0000
committerrrs <rrs@FreeBSD.org>2010-06-05 21:17:23 +0000
commit7d3c46ab4c339f80c43882895ddd4543a6aec864 (patch)
treea8a312f938dcff7bd975de5b5e53db2d48149ed4
parent96cb657bdf00b215403deba4baf48e701efb691e (diff)
downloadFreeBSD-src-7d3c46ab4c339f80c43882895ddd4543a6aec864.zip
FreeBSD-src-7d3c46ab4c339f80c43882895ddd4543a6aec864.tar.gz
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
-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 a89573a..cccd8c50 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))
OpenPOWER on IntegriCloud