idr: revert misallocation bug fix
Subsystems (2)
PATCH 1/1 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.
---
Sorry this wasn't found before hitting mainline. It looks like this will have to stay broken for a bit more. I'll make an userland test rig and find out what's going on.
Thanks.
lib/idr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
lib/idr.c +4 -3
@@ -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 ; }
Quoted 7 lines · Tejun Heo
Commit
859ddf09743a8cc680af33f7259ccd0fd36bfe9dtried 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 <[email protected]>
Bah. I just ran into and bisected the X startup problem. :)
Let me know when you have a proper fix. I can test on my machine for you.
-- Dave
Hello,
Quoted 4 lines · Dave Hansen
Bah. I just ran into and bisected the X startup problem. :)
Let me know when you have a proper fix. I can test on my machine for you.
Can you please test the following against the current mainline?
Thanks.
lib/idr.c +3 -1
@@ -156,10 +156,12 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa) id = (id | ((1 << (IDR_BITS * l)) -1 )) +1 ;/* if already at the top layer, we need to grow */ -if (!(p = pa[l])) { +if (id >=1 << (idp->layers *IDR_BITS )) { *starting_id = id;return IDR_NEED_TO_GROW ; } + p = pa[l]; +BUG_ON (!p);/* If we need to go up one layer, continue the * loop; otherwise, restart from the top.
Signature · 1 line
tejun