From owner-svn-src-head@FreeBSD.ORG Sat May 30 10:56:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A212106564A; Sat, 30 May 2009 10:56:27 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 880528FC0A; Sat, 30 May 2009 10:56:27 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UAuRoA004265; Sat, 30 May 2009 10:56:27 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UAuRR7004263; Sat, 30 May 2009 10:56:27 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <200905301056.n4UAuRR7004263@svn.freebsd.org> From: Randall Stewart Date: Sat, 30 May 2009 10:56:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193089 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 10:56:28 -0000 Author: rrs Date: Sat May 30 10:56:27 2009 New Revision: 193089 URL: http://svn.freebsd.org/changeset/base/193089 Log: Fix a small memory leak from the nr-sack code - the mapping array was not being freed at term of association. Also get rid of the MICHAELS_EXP code. Modified: head/sys/netinet/sctp_pcb.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat May 30 10:50:40 2009 (r193088) +++ head/sys/netinet/sctp_pcb.c Sat May 30 10:56:27 2009 (r193089) @@ -4104,9 +4104,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; /* put it in the bucket in the vtag hash of assoc's for the system */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); -#ifdef MICHAELS_EXPERIMENT - sctp_delete_from_timewait(stcb->asoc.my_vtag, inp->sctp_lport, stcb->rport); -#endif SCTP_INP_INFO_WUNLOCK(); if ((err = sctp_add_remote_addr(stcb, firstaddr, SCTP_DO_SETSCOPE, SCTP_ALLOC_ASOC))) { @@ -4119,6 +4116,10 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, SCTP_FREE(asoc->mapping_array, SCTP_M_MAP); asoc->mapping_array = NULL; } + if (asoc->nr_mapping_array) { + SCTP_FREE(asoc->nr_mapping_array, SCTP_M_MAP); + asoc->nr_mapping_array = NULL; + } SCTP_DECR_ASOC_COUNT(); SCTP_TCB_LOCK_DESTROY(stcb); SCTP_TCB_SEND_LOCK_DESTROY(stcb); @@ -4881,6 +4882,10 @@ sctp_free_assoc(struct sctp_inpcb *inp, SCTP_FREE(asoc->mapping_array, SCTP_M_MAP); asoc->mapping_array = NULL; } + if (asoc->nr_mapping_array) { + SCTP_FREE(asoc->nr_mapping_array, SCTP_M_MAP); + asoc->nr_mapping_array = NULL; + } /* the stream outs */ if (asoc->strmout) { SCTP_FREE(asoc->strmout, SCTP_M_STRMO); @@ -6378,21 +6383,6 @@ skip_vtag_check: } } SCTP_INP_INFO_RUNLOCK(); -#ifdef MICHAELS_EXPERIMENT - /*- - * Not found, ok to use the tag, add it to the time wait hash - * as well this will prevent two sucessive cookies from getting - * the same tag or two inits sent quickly on multi-processors. - * We only keep the tag for the life of a cookie and when we - * add this tag to the assoc hash we need to purge it from - * the t-wait hash. - */ - SCTP_INP_INFO_WLOCK(); - if (save_in_twait) - sctp_add_vtag_to_timewait(tag, TICKS_TO_SEC(inp->sctp_ep.def_cookie_life, lport, rport)); - SCTP_INP_INFO_WUNLOCK(); -#endif - return (1); } Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sat May 30 10:50:40 2009 (r193088) +++ head/sys/netinet/sctputil.c Sat May 30 10:56:27 2009 (r193089) @@ -917,24 +917,7 @@ sctp_init_asoc(struct sctp_inpcb *m, str #endif asoc->sb_send_resv = 0; if (override_tag) { -#ifdef MICHAELS_EXPERIMENT - if (sctp_is_in_timewait(override_tag, stcb->sctp_ep->sctp_lport, stcb->rport)) { - /* - * It must be in the time-wait hash, we put it there - * when we aloc one. If not the peer is playing - * games. - */ - asoc->my_vtag = override_tag; - } else { - SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ENOMEM); -#ifdef INVARIANTS - panic("Huh is_in_timewait fails"); -#endif - return (ENOMEM); - } -#else asoc->my_vtag = override_tag; -#endif } else { asoc->my_vtag = sctp_select_a_tag(m, stcb->sctp_ep->sctp_lport, stcb->rport, 1); } @@ -1159,11 +1142,12 @@ sctp_init_asoc(struct sctp_inpcb *m, str asoc->nr_mapping_array_size = SCTP_INITIAL_NR_MAPPING_ARRAY; SCTP_MALLOC(asoc->nr_mapping_array, uint8_t *, asoc->nr_mapping_array_size, SCTP_M_MAP); - /* - * if (asoc->nr_mapping_array == NULL) { SCTP_FREE(asoc->strmout, - * SCTP_M_STRMO); SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, - * SCTP_FROM_SCTPUTIL, ENOMEM); return (ENOMEM); } - */ + if (asoc->nr_mapping_array == NULL) { + SCTP_FREE(asoc->strmout, SCTP_M_STRMO); + SCTP_FREE(asoc->mapping_array, SCTP_M_MAP); + SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ENOMEM); + return (ENOMEM); + } memset(asoc->nr_mapping_array, 0, asoc->nr_mapping_array_size); /* Now the init of the other outqueues */