summaryrefslogtreecommitdiffstats
path: root/arch/arm/mm
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-07-30 21:24:56 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-30 21:24:56 +0100
commitb962a286e500c6259af8ba133361f8528eed9172 (patch)
treecdb19c3ac525cb025dbfb4612decab9e1b030f7b /arch/arm/mm
parent905a09d57afcc49511de18a95605c11ad9c88649 (diff)
downloadop-kernel-dev-b962a286e500c6259af8ba133361f8528eed9172.zip
op-kernel-dev-b962a286e500c6259af8ba133361f8528eed9172.tar.gz
[ARM] initrd: claim initrd memory exclusively
Claim the initrd memory exclusively, and order other memory reservations beforehand. This allows us to determine whether the initrd memory was overwritten, and disable the initrd in that case. This avoids a 'bad page state' bug. Tested-by: Ralph Siemsen <ralphs@netwinder.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r--arch/arm/mm/init.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index e635294..30a69d6 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -156,9 +156,9 @@ static int __init check_initrd(struct meminfo *mi)
}
if (initrd_node == -1) {
- printk(KERN_ERR "initrd (0x%08lx - 0x%08lx) extends beyond "
+ printk(KERN_ERR "INITRD: 0x%08lx+0x%08lx extends beyond "
"physical memory - disabling initrd\n",
- phys_initrd_start, end);
+ phys_initrd_start, phys_initrd_size);
phys_initrd_start = phys_initrd_size = 0;
}
#endif
@@ -239,25 +239,33 @@ bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT,
boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
+ /*
+ * Reserve any special node zero regions.
+ */
+ if (node == 0)
+ reserve_node_zero(pgdat);
+
#ifdef CONFIG_BLK_DEV_INITRD
/*
* If the initrd is in this node, reserve its memory.
*/
if (node == initrd_node) {
- reserve_bootmem_node(pgdat, phys_initrd_start,
- phys_initrd_size, BOOTMEM_DEFAULT);
- initrd_start = __phys_to_virt(phys_initrd_start);
- initrd_end = initrd_start + phys_initrd_size;
+ int res = reserve_bootmem_node(pgdat, phys_initrd_start,
+ phys_initrd_size, BOOTMEM_EXCLUSIVE);
+
+ if (res == 0) {
+ initrd_start = __phys_to_virt(phys_initrd_start);
+ initrd_end = initrd_start + phys_initrd_size;
+ } else {
+ printk(KERN_ERR
+ "INITRD: 0x%08lx+0x%08lx overlaps in-use "
+ "memory region - disabling initrd\n",
+ phys_initrd_start, phys_initrd_size);
+ }
}
#endif
/*
- * Finally, reserve any node zero regions.
- */
- if (node == 0)
- reserve_node_zero(pgdat);
-
- /*
* initialise the zones within this node.
*/
memset(zone_size, 0, sizeof(zone_size));
OpenPOWER on IntegriCloud