Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Feb 2016 10:03:50 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r295506 - head/sys/netinet
Message-ID:  <201602111003.u1BA3oiV018009@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602111003.u1BA3oiV018009>