summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-02-04 09:57:37 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2010-02-05 01:03:41 +0100
commit6f14a668f1a8b715a6e855f4e32705e54a6e86a1 (patch)
tree3583162191f16c1d622fe1f6872870e6ae3fbfe8 /lib
parentMerge branch 'for-linus' of git://git.monstr.eu/linux-2.6-microblaze (diff)
downloadlinux-6f14a668f1a8b715a6e855f4e32705e54a6e86a1.tar.xz
linux-6f14a668f1a8b715a6e855f4e32705e54a6e86a1.zip
idr: revert misallocation bug fix
Commit 859ddf09743a8cc680af33f7259ccd0fd36bfe9d tried to fix misallocation bug but broke full bit marking by not clearing pa[idp->layers] and also is causing X failures due to lookup failure in drm code. The cause of the latter hasn't been found yet. Revert the fix for now. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/idr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/idr.c b/lib/idr.c
index ba7d37cf7847..1cac726c44bc 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -140,7 +140,8 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa)
id = *starting_id;
restart:
p = idp->top;
- l = p->layer;
+ l = idp->layers;
+ pa[l--] = NULL;
while (1) {
/*
* We run around this while until we reach the leaf node...
@@ -154,8 +155,8 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa)
oid = id;
id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1;
- /* did id go over the limit? */
- if (id >= (1 << (idp->layers * IDR_BITS))) {
+ /* if already at the top layer, we need to grow */
+ if (!(p = pa[l])) {
*starting_id = id;
return IDR_NEED_TO_GROW;
}