svn commit: r247978 - stable/8/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Thu Mar 7 23:51:08 UTC 2013


Author: tuexen
Date: Thu Mar  7 23:51:07 2013
New Revision: 247978
URL: http://svnweb.freebsd.org/changeset/base/247978

Log:
  MFC r238550:
  
  Fix a refcount bug when freeing an association.
  While there: Change code to be consistent.
  Discussed with rrs at .

Modified:
  stable/8/sys/netinet/sctp_pcb.c
  stable/8/sys/netinet/sctputil.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/netinet/   (props changed)

Modified: stable/8/sys/netinet/sctp_pcb.c
==============================================================================
--- stable/8/sys/netinet/sctp_pcb.c	Thu Mar  7 23:48:29 2013	(r247977)
+++ stable/8/sys/netinet/sctp_pcb.c	Thu Mar  7 23:51:07 2013	(r247978)
@@ -4872,6 +4872,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, 
 		/* now clean up any chunks here */
 		TAILQ_FOREACH_SAFE(sp, &outs->outqueue, next, nsp) {
 			TAILQ_REMOVE(&outs->outqueue, sp, next);
+			sctp_free_spbufspace(stcb, asoc, sp);
 			if (sp->data) {
 				if (so) {
 					/* Still an open socket - report */
@@ -4882,19 +4883,14 @@ sctp_free_assoc(struct sctp_inpcb *inp, 
 					sctp_m_freem(sp->data);
 					sp->data = NULL;
 					sp->tail_mbuf = NULL;
+					sp->length = 0;
 				}
 			}
 			if (sp->net) {
 				sctp_free_remote_addr(sp->net);
 				sp->net = NULL;
 			}
-			sctp_free_spbufspace(stcb, asoc, sp);
-			if (sp->holds_key_ref)
-				sctp_auth_key_release(stcb, sp->auth_keyid, SCTP_SO_LOCKED);
-			/* Free the zone stuff  */
-			SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), sp);
-			SCTP_DECR_STRMOQ_COUNT();
-			/* sa_ignore FREED_MEMORY */
+			sctp_free_a_strmoq(stcb, sp, SCTP_SO_LOCKED);
 		}
 	}
 	/* sa_ignore FREED_MEMORY */

Modified: stable/8/sys/netinet/sctputil.c
==============================================================================
--- stable/8/sys/netinet/sctputil.c	Thu Mar  7 23:48:29 2013	(r247977)
+++ stable/8/sys/netinet/sctputil.c	Thu Mar  7 23:51:07 2013	(r247978)
@@ -3774,6 +3774,8 @@ sctp_report_all_outbound(struct sctp_tcb
 				if (sp->data) {
 					sctp_m_freem(sp->data);
 					sp->data = NULL;
+					sp->tail_mbuf = NULL;
+					sp->length = 0;
 				}
 			}
 			if (sp->net) {
@@ -4833,7 +4835,7 @@ sctp_release_pr_sctp_chunk(struct sctp_t
 					/*
 					 * Pull any data to free up the SB
 					 * and allow sender to "add more"
-					 * whilc we will throw away :-)
+					 * while we will throw away :-)
 					 */
 					sctp_free_spbufspace(stcb, &stcb->asoc,
 					    sp);
@@ -4841,9 +4843,9 @@ sctp_release_pr_sctp_chunk(struct sctp_t
 					do_wakeup_routine = 1;
 					sp->some_taken = 1;
 					sctp_m_freem(sp->data);
-					sp->length = 0;
 					sp->data = NULL;
 					sp->tail_mbuf = NULL;
+					sp->length = 0;
 				}
 				break;
 			}


More information about the svn-src-all mailing list