From owner-svn-src-head@freebsd.org Thu Feb 11 10:03:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99951A9F3DB; Thu, 11 Feb 2016 10:03:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65D2E1C22; Thu, 11 Feb 2016 10:03:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u1BA3oVo018010; Thu, 11 Feb 2016 10:03:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1BA3oiV018009; Thu, 11 Feb 2016 10:03:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201602111003.u1BA3oiV018009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 11 Feb 2016 10:03:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r295506 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Feb 2016 10:03:51 -0000 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: