OSDN Git Service

ARM: initrd: disable initrds outside of memory
authorRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 10 Jun 2011 23:43:21 +0000 (00:43 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 10 Jun 2011 23:43:21 +0000 (00:43 +0100)
We can't cope with initrds outside of memory, so check that the
initrd is within some declared memory to the kernel before using
it.  Otherwise we're likely to OOPS during boot.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/init.c

index b2cf946..c19571c 100644 (file)
@@ -331,6 +331,12 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
 #endif
 #ifdef CONFIG_BLK_DEV_INITRD
        if (phys_initrd_size &&
+           !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) {
+               pr_err("INITRD: 0x%08lx+0x%08lx is not a memory region - disabling initrd\n",
+                      phys_initrd_start, phys_initrd_size);
+               phys_initrd_start = phys_initrd_size = 0;
+       }
+       if (phys_initrd_size &&
            memblock_is_region_reserved(phys_initrd_start, phys_initrd_size)) {
                pr_err("INITRD: 0x%08lx+0x%08lx overlaps in-use memory region - disabling initrd\n",
                       phys_initrd_start, phys_initrd_size);