提交 6f14a668 编写于 作者: T Tejun Heo 提交者: Linus Torvalds

idr: revert misallocation bug fix

Commit 859ddf09 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: NTejun Heo <tj@kernel.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e9e70bc1
...@@ -140,7 +140,8 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa) ...@@ -140,7 +140,8 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa)
id = *starting_id; id = *starting_id;
restart: restart:
p = idp->top; p = idp->top;
l = p->layer; l = idp->layers;
pa[l--] = NULL;
while (1) { while (1) {
/* /*
* We run around this while until we reach the leaf node... * 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) ...@@ -154,8 +155,8 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa)
oid = id; oid = id;
id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1; id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1;
/* did id go over the limit? */ /* if already at the top layer, we need to grow */
if (id >= (1 << (idp->layers * IDR_BITS))) { if (!(p = pa[l])) {
*starting_id = id; *starting_id = id;
return IDR_NEED_TO_GROW; return IDR_NEED_TO_GROW;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册