summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_pcb.c
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2010-11-13 12:52:44 +0000
committertuexen <tuexen@FreeBSD.org>2010-11-13 12:52:44 +0000
commitc0d6d04d712c9b773c0b658901e781197e1332ab (patch)
tree7ba4633ed8c443df5c71758e8d4f0c2239cdc23a /sys/netinet/sctp_pcb.c
parent3d022d63eb9c81aaabb61b0ecf4d6789f136ec0c (diff)
downloadFreeBSD-src-c0d6d04d712c9b773c0b658901e781197e1332ab.zip
FreeBSD-src-c0d6d04d712c9b773c0b658901e781197e1332ab.tar.gz
Fix a locking issue reported by brucec@ affecting
1-to-1 style sockets which have not yet been accepted. MFC after: 3 days.
Diffstat (limited to 'sys/netinet/sctp_pcb.c')
-rw-r--r--sys/netinet/sctp_pcb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c
index 7e305c4..aaa0500 100644
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -3464,6 +3464,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from)
cnt = 0;
for ((asoc = LIST_FIRST(&inp->sctp_asoc_list)); asoc != NULL;
asoc = nasoc) {
+ SCTP_TCB_LOCK(asoc);
nasoc = LIST_NEXT(asoc, sctp_tcblist);
if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
if (asoc->asoc.state & SCTP_STATE_IN_ACCEPT_QUEUE) {
@@ -3471,10 +3472,10 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from)
sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, asoc, NULL);
}
cnt++;
+ SCTP_TCB_UNLOCK(asoc);
continue;
}
/* Free associations that are NOT killing us */
- SCTP_TCB_LOCK(asoc);
if ((SCTP_GET_STATE(&asoc->asoc) != SCTP_STATE_COOKIE_WAIT) &&
((asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0)) {
struct mbuf *op_err;
OpenPOWER on IntegriCloud