PERFORCE change 133940 for review

Andre Oppermann andre at FreeBSD.org
Wed Jan 23 12:01:29 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=133940

Change 133940 by andre at andre_flirtbox on 2008/01/23 20:00:45

	Fix memory leak when length is zero.  We must always consume
	the mbuf.  Add commment to note this.

Affected files ...

.. //depot/projects/tcp_reass/netinet/tcp_reass.c#14 edit

Differences ...

==== //depot/projects/tcp_reass/netinet/tcp_reass.c#14 (text+ko) ====

@@ -156,6 +156,9 @@
 
 /*
  * Insert segments into the reassembly queue.
+ *
+ * NB: We must always consume the mbuf.  Either by appeding it to
+ * the queue or by freeing it.
  */
 int
 tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m)
@@ -190,8 +193,10 @@
 	}
 
 	/* XXX: should not happen, but does for some reason. */
-	if (*tlenp == 0)
+	if (*tlenp == 0) {
+		m_freem(m);
 		return (0);
+	}
 
 	KASSERT(*tlenp > 0,
 	    ("%s: segment doesn't contain any data", __func__));


More information about the p4-projects mailing list