linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.33-rc6] idr: revert misallocation bug fix
@ 2010-02-04  8:57 Tejun Heo
  2010-02-04 20:58 ` Dave Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2010-02-04  8:57 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton, lkml, dri-devel, Dave Airlie,
	Greg KH, Eric Paris

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>
---
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(-)

diff --git a/lib/idr.c b/lib/idr.c
index ba7d37c..1cac726 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;
 			}

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.6.33-rc6] idr: revert misallocation bug fix
  2010-02-04  8:57 [PATCH 2.6.33-rc6] idr: revert misallocation bug fix Tejun Heo
@ 2010-02-04 20:58 ` Dave Hansen
  2010-02-11  8:52   ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Hansen @ 2010-02-04 20:58 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Linus Torvalds, Andrew Morton, lkml, dri-devel, Dave Airlie,
	Greg KH, Eric Paris

On Thu, 2010-02-04 at 17:57 +0900, Tejun Heo wrote:
> 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>

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.6.33-rc6] idr: revert misallocation bug fix
  2010-02-04 20:58 ` Dave Hansen
@ 2010-02-11  8:52   ` Tejun Heo
  0 siblings, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2010-02-11  8:52 UTC (permalink / raw)
  To: Dave Hansen
  Cc: Linus Torvalds, Andrew Morton, lkml, dri-devel, Dave Airlie,
	Greg KH, Eric Paris

Hello,

On 02/05/2010 05:58 AM, Dave Hansen wrote:
> 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.

diff --git a/lib/idr.c b/lib/idr.c
index 1cac726..0dc7822 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -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.


-- 
tejun

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-11  8:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-04  8:57 [PATCH 2.6.33-rc6] idr: revert misallocation bug fix Tejun Heo
2010-02-04 20:58 ` Dave Hansen
2010-02-11  8:52   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).