From owner-svn-src-all@FreeBSD.ORG Wed Sep 16 13:44:12 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F06931065670; Wed, 16 Sep 2009 13:44:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCCC38FC15; Wed, 16 Sep 2009 13:44:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8GDiCr7026107; Wed, 16 Sep 2009 13:44:12 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8GDiCAX026105; Wed, 16 Sep 2009 13:44:12 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <200909161344.n8GDiCAX026105@svn.freebsd.org> From: Michael Tuexen Date: Wed, 16 Sep 2009 13:44:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197256 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2009 13:44:13 -0000 Author: tuexen Date: Wed Sep 16 13:44:12 2009 New Revision: 197256 URL: http://svn.freebsd.org/changeset/base/197256 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. Approved by: re, rrs (mentor) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/netinet/sctp_pcb.c Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Wed Sep 16 13:24:37 2009 (r197255) +++ stable/8/sys/netinet/sctp_pcb.c Wed Sep 16 13:44:12 2009 (r197256) @@ -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);