diff options
author | rrs <rrs@FreeBSD.org> | 2009-09-13 17:45:31 +0000 |
---|---|---|
committer | rrs <rrs@FreeBSD.org> | 2009-09-13 17:45:31 +0000 |
commit | 314c72fba8b9e2cf50350d80b531ef304b48f9b0 (patch) | |
tree | c3956b41be0c427c3a9bb326b91a4746a9d81eff /sys/netinet | |
parent | 77ca19e436d61af07e94d536b1b46e136a1bfe9d (diff) | |
download | FreeBSD-src-314c72fba8b9e2cf50350d80b531ef304b48f9b0.zip FreeBSD-src-314c72fba8b9e2cf50350d80b531ef304b48f9b0.tar.gz |
Fixes two bugs:
1) A lock issue, if we ever had to try again
we would double lock the INP lock.
2) We were allowing (at wrap) associd 0... which really
we cannot allow since 0 normally means in most socket
API calls that we are wishing to effect something on
the INP not TCB.
MFC after: 1 week
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/sctp_pcb.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index c5a8ddf..0d1f1e0 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -3926,12 +3926,20 @@ sctp_aloc_a_assoc_id(struct sctp_inpcb *inp, struct sctp_tcb *stcb) struct sctpasochead *head; struct sctp_tcb *lstcb; + SCTP_INP_WLOCK(inp); try_again: if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) { /* TSNH */ + SCTP_INP_WUNLOCK(inp); return (0); } - SCTP_INP_WLOCK(inp); + /* + * We don't allow assoc id to be 0, this is needed otherwise if the + * id were to wrap we would have issues with some socket options. + */ + if (inp->sctp_associd_counter == 0) { + inp->sctp_associd_counter++; + } id = inp->sctp_associd_counter; inp->sctp_associd_counter++; lstcb = sctp_findasoc_ep_asocid_locked(inp, (sctp_assoc_t) id, 0); |