svn commit: r295506 - head/sys/netinet

Hans Petter Selasky hselasky at FreeBSD.org
Thu Feb 11 10:03:51 UTC 2016


Author: hselasky
Date: Thu Feb 11 10:03:50 2016
New Revision: 295506
URL: https://svnweb.freebsd.org/changeset/base/295506

Log:
  Use a pair of ifs when comparing the 32-bit flowid integers so that
  the sign bit doesn't cause an overflow. The overflow manifests itself
  as a sorting index wrap around in the middle of the sorted array,
  which is not a problem for the LRO code, but might be a problem for
  the logic inside qsort().
  
  Reviewed by:		gnn @
  Sponsored by:		Mellanox Technologies
  Differential Revision:	https://reviews.freebsd.org/D5239

Modified:
  head/sys/netinet/tcp_lro.c

Modified: head/sys/netinet/tcp_lro.c
==============================================================================
--- head/sys/netinet/tcp_lro.c	Thu Feb 11 06:50:11 2016	(r295505)
+++ head/sys/netinet/tcp_lro.c	Thu Feb 11 10:03:50 2016	(r295506)
@@ -347,9 +347,10 @@ tcp_lro_mbuf_compare_header(const void *
 	if (ret != 0)
 		goto done;
 
-	ret = ma->m_pkthdr.flowid - mb->m_pkthdr.flowid;
-	if (ret != 0)
-		goto done;
+	if (ma->m_pkthdr.flowid > mb->m_pkthdr.flowid)
+		return (1);
+	else if (ma->m_pkthdr.flowid < mb->m_pkthdr.flowid)
+		return (-1);
 
 	ret = TCP_LRO_SEQUENCE(ma) - TCP_LRO_SEQUENCE(mb);
 done:


More information about the svn-src-head mailing list