From 9d3c01e391007fbb235d43b805df34be44152281 Mon Sep 17 00:00:00 2001 From: Navdeep Parhar Date: Mon, 2 Feb 2015 23:41:43 +0000 Subject: [PATCH] Fix bug in idr_pre_get where it doesn't handle 'need' correctly. Obtained from: Chelsio Communications' internal repository. --- sys/ofed/include/linux/linux_idr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/ofed/include/linux/linux_idr.c b/sys/ofed/include/linux/linux_idr.c index 3397cda4eb0..809e1784e5b 100644 --- a/sys/ofed/include/linux/linux_idr.c +++ b/sys/ofed/include/linux/linux_idr.c @@ -223,7 +223,7 @@ idr_pre_get(struct idr *idr, gfp_t gfp_mask) for (il = idr->free; il != NULL; il = il->ary[0]) need--; mtx_unlock(&idr->lock); - if (need == 0) + if (need <= 0) break; for (head = NULL; need; need--) { iln = malloc(sizeof(*il), M_IDR, M_ZERO | gfp_mask);