idr: Fix an infinite loop issue
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 5 Dec 2013 09:25:23 +0000 (10:25 +0100)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Thu, 5 Dec 2013 14:10:44 +0000 (15:10 +0100)
commitadeb26dc7533ec231d3af71c3aa551c8d3d94390
treeecf2778cb3f790eef5199b8315ec8fb79c07e578
parent80f42d0a6a8b9229c3e4be236c68ee3b31b2a049
idr: Fix an infinite loop issue

* idr routines were doing an infinite loop when the array was full but element
  #0 was still free

* Because allocations start at 1, the low bound was not being taken account of
  in idr_find_free(), causing an infinite loop

* idr_get_new_above() couldn't allocate an id >= 1 and idr_pre_get() thought it
  didn't have to expand because id #0 was available
sys/libkern/linux_idr.c
sys/sys/idr.h