diff options
author | np <np@FreeBSD.org> | 2013-06-08 07:23:26 +0000 |
---|---|---|
committer | np <np@FreeBSD.org> | 2013-06-08 07:23:26 +0000 |
commit | e9cf267187edb4e42a3c4f272a5d9d8db4c01993 (patch) | |
tree | 121cacc6dea6a8489759fa77c96124d2333df799 /sys/dev | |
parent | ea7394f077167173cf7e70d1ed4e85236ccb5028 (diff) | |
download | FreeBSD-src-e9cf267187edb4e42a3c4f272a5d9d8db4c01993.zip FreeBSD-src-e9cf267187edb4e42a3c4f272a5d9d8db4c01993.tar.gz |
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
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/cxgbe/offload.h | 4 | ||||
-rw-r--r-- | sys/dev/cxgbe/tom/t4_listen.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/cxgbe/offload.h b/sys/dev/cxgbe/offload.h index 55ac71b..6090775 100644 --- a/sys/dev/cxgbe/offload.h +++ b/sys/dev/cxgbe/offload.h @@ -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 */ }; /* diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index aa76762..7db4126 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -125,7 +125,7 @@ alloc_stid(struct adapter *sc, struct listen_ctx *lctx, int isipv6) 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); |