Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Jun 2013 07:23:26 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
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
Message-ID:  <201306080723.r587NQpx051654@svn.freebsd.org>

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



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