From owner-svn-src-head@FreeBSD.ORG Sat Jun 8 07:23:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4CBC1E39; Sat, 8 Jun 2013 07:23:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3E61018FB; Sat, 8 Jun 2013 07:23:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r587NQmg051656; Sat, 8 Jun 2013 07:23:26 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r587NQpx051654; Sat, 8 Jun 2013 07:23:26 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201306080723.r587NQpx051654@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 8 Jun 2013 07:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251518 - in head/sys/dev/cxgbe: . tom 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.14 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: Sat, 08 Jun 2013 07:23:27 -0000 Author: np Date: Sat Jun 8 07:23:26 2013 New Revision: 251518 URL: http://svnweb.freebsd.org/changeset/base/251518 Log: cxgbe/tom: Fix bad signed/unsigned mixup in the stid allocator. This fixes a panic when allocating a mixture of IPv6 and IPv4 stids. MFC after: 1 week Modified: head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgbe/offload.h ============================================================================== --- head/sys/dev/cxgbe/offload.h Sat Jun 8 07:16:22 2013 (r251517) +++ head/sys/dev/cxgbe/offload.h Sat Jun 8 07:23:26 2013 (r251518) @@ -59,8 +59,8 @@ struct listen_ctx; struct stid_region { TAILQ_ENTRY(stid_region) link; - int used; /* # of stids used by this region */ - int free; /* # of contiguous stids free right after this region */ + u_int used; /* # of stids used by this region */ + u_int free; /* # of contiguous stids free right after this region */ }; /* Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Sat Jun 8 07:16:22 2013 (r251517) +++ head/sys/dev/cxgbe/tom/t4_listen.c Sat Jun 8 07:23:26 2013 (r251518) @@ -125,7 +125,7 @@ alloc_stid(struct adapter *sc, struct li TAILQ_FOREACH(s, &t->stids, link) { stid += s->used + s->free; f = stid & mask; - if (n <= s->free - f) { + if (s->free >= n + f) { stid -= n + f; s->free -= n + f; TAILQ_INSERT_AFTER(&t->stids, s, sr, link);