Re: Bug while executing : cat /proc/iomem on 2.6.17-rc1/rc2

From: Russell King
Date: Thu May 11 2006 - 03:32:05 EST


On Thu, May 11, 2006 at 12:57:48PM +0530, Sharyathi Nagesh wrote:
> I was able to replicate the Bug, even when all the drivers are built into the kernel.
> It looks like while traversing through p->parent field of resource structure is leading to NULL pointer.
> Would it be appropriate to make the following code change.
> But I found cat /proc/iomem hangs after line kernel data..
>
> --- kernel/resource.c.old 2006-05-11 05:29:33.000000000 -0700
> +++ kernel/resource.c 2006-05-11 05:29:58.000000000 -0700
> @@ -81,7 +81,7 @@ static int r_show(struct seq_file *m, vo
> int depth;
>
> for (depth = 0, p = r; depth < MAX_IORES_LEVEL; depth++, p = p->parent){
> - if (p->parent == root)
> + if (p->parent == root || p->parent == NULL)
> break;
> }
> seq_printf(m, "%*s%0*lx-%0*lx : %s\n",

Only the root should have a NULL parent, so this is just covering up some
other problem - you have a resource which somehow has illegally ended up
with a NULL parent pointer while it's been registered.

Maybe try adding:

if (p->parent == NULL) {
printk("resource with null parent: %lx-%lx: %s\n",
p->start, p->end, p->name);
break;
}

just before the test in that loop, and then finding out why that resource
is becoming invalid.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/