Date: Sun, 13 Sep 2009 17:45:31 +0000 (UTC) From: Randall Stewart <rrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r197173 - head/sys/netinet Message-ID: <200909131745.n8DHjV6p027654@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rrs Date: Sun Sep 13 17:45:31 2009 New Revision: 197173 URL: http://svn.freebsd.org/changeset/base/197173 Log: 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 Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sun Sep 13 17:30:56 2009 (r197172) +++ head/sys/netinet/sctp_pcb.c Sun Sep 13 17:45:31 2009 (r197173) @@ -3926,12 +3926,20 @@ sctp_aloc_a_assoc_id(struct sctp_inpcb * 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909131745.n8DHjV6p027654>