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>

authored by Tejun Heo and committed by Linus Torvalds 6f14a668 e9e70bc1

+4 -3
+4 -3
lib/idr.c
··· 140 140 id = *starting_id; 141 141 restart: 142 142 p = idp->top; 143 - l = p->layer; 143 + l = idp->layers; 144 + pa[l--] = NULL; 144 145 while (1) { 145 146 /* 146 147 * We run around this while until we reach the leaf node... ··· 155 154 oid = id; 156 155 id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1; 157 156 158 - /* did id go over the limit? */ 159 - if (id >= (1 << (idp->layers * IDR_BITS))) { 157 + /* if already at the top layer, we need to grow */ 158 + if (!(p = pa[l])) { 160 159 *starting_id = id; 161 160 return IDR_NEED_TO_GROW; 162 161 }