svn commit: r192564 - user/kmacy/releng_7_2_fcs/sys/kern

Kip Macy kmacy at FreeBSD.org
Thu May 21 19:44:05 UTC 2009


Author: kmacy
Date: Thu May 21 19:44:05 2009
New Revision: 192564
URL: http://svn.freebsd.org/changeset/base/192564

Log:
  MFC 192516, adding additional checks to sbsndptr

Modified:
  user/kmacy/releng_7_2_fcs/sys/kern/uipc_sockbuf.c

Modified: user/kmacy/releng_7_2_fcs/sys/kern/uipc_sockbuf.c
==============================================================================
--- user/kmacy/releng_7_2_fcs/sys/kern/uipc_sockbuf.c	Thu May 21 19:33:46 2009	(r192563)
+++ user/kmacy/releng_7_2_fcs/sys/kern/uipc_sockbuf.c	Thu May 21 19:44:05 2009	(r192564)
@@ -575,10 +575,6 @@ sbappendrecord_locked(struct sockbuf *sb
 
 	if (m0 == 0)
 		return;
-	m = sb->sb_mb;
-	if (m)
-		while (m->m_nextpkt)
-			m = m->m_nextpkt;
 	/*
 	 * Put the first mbuf on the queue.  Note this permits zero length
 	 * records.
@@ -586,10 +582,7 @@ sbappendrecord_locked(struct sockbuf *sb
 	sballoc(sb, m0);
 	SBLASTRECORDCHK(sb);
 	SBLINKRECORD(sb, m0);
-	if (m)
-		m->m_nextpkt = m0;
-	else
-		sb->sb_mb = m0;
+	sb->sb_mbtail = m0;
 	m = m0->m_next;
 	m0->m_next = 0;
 	if (m && (m0->m_flags & M_EOR)) {
@@ -935,11 +928,13 @@ sbsndptr(struct sockbuf *sb, u_int off, 
 
 	/* Advance by len to be as close as possible for the next transmit. */
 	for (off = off - sb->sb_sndptroff + len - 1;
-	     off > 0 && off >= m->m_len;
+	     off > 0 && m != NULL && off >= m->m_len;
 	     m = m->m_next) {
 		sb->sb_sndptroff += m->m_len;
 		off -= m->m_len;
 	}
+	if (off > 0 && m == NULL)
+		panic("%s: sockbuf %p and mbuf %p clashing", __func__, sb, ret);
 	sb->sb_sndptr = m;
 
 	return (ret);


More information about the svn-src-user mailing list