Fix bug in idr_pre_get where it doesn't handle 'need' correctly.

Obtained from:	Chelsio Communications' internal repository.
This commit is contained in:
Navdeep Parhar 2015-02-02 23:41:43 +00:00
parent 681c32931f
commit 9d3c01e391

View File

@ -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);