]> git.baikalelectronics.ru Git - kernel.git/commit
idr: fix obscure bug in allocation path
authorTejun Heo <htejun@gmail.com>
Wed, 13 Jun 2007 18:45:12 +0000 (03:45 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 11 Jul 2007 23:09:02 +0000 (16:09 -0700)
commit5277f5152757653c72ba3a81e70dee1fd871e39e
treeb6b2e4d4942fd199768f6df6b0694a886e8c4375
parent6e97d38a150c547e1579da4802e8e83fee6d92b5
idr: fix obscure bug in allocation path

In sub_alloc(), when bitmap search fails, it goes up one level to
continue search.  This is done by updating the id cursor and searching
the upper level again.  If the cursor was at the end of the upper
level, we need to go further than that.

This wasn't implemented and when that happens the part of the cursor
which indexes into the upper level wraps and sub_alloc() ends up
searching the wrong bitmap.  It allocates id which doesn't match the
actual slot.

This patch fixes this by restarting from the top if the search needs
to go higher than one level.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
lib/idr.c