aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/init.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-07-30 16:24:56 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-30 16:24:56 -0400
commitb962a286e500c6259af8ba133361f8528eed9172 (patch)
treecdb19c3ac525cb025dbfb4612decab9e1b030f7b /arch/arm/mm/init.c
parent905a09d57afcc49511de18a95605c11ad9c88649 (diff)
[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/init.c')
-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 e6352946dde0..30a69d67d673 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)
156 } 156 }
157 157
158 if (initrd_node == -1) { 158 if (initrd_node == -1) {
159 printk(KERN_ERR "initrd (0x%08lx - 0x%08lx) extends beyond " 159 printk(KERN_ERR "INITRD: 0x%08lx+0x%08lx extends beyond "
160 "physical memory - disabling initrd\n", 160 "physical memory - disabling initrd\n",
161 phys_initrd_start, end); 161 phys_initrd_start, phys_initrd_size);
162 phys_initrd_start = phys_initrd_size = 0; 162 phys_initrd_start = phys_initrd_size = 0;
163 } 163 }
164#endif 164#endif
@@ -239,25 +239,33 @@ bootmem_init_node(int node, int initrd_node, struct meminfo *mi)
239 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT, 239 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT,
240 boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT); 240 boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
241 241
242 /*
243 * Reserve any special node zero regions.
244 */
245 if (node == 0)
246 reserve_node_zero(pgdat);
247
242#ifdef CONFIG_BLK_DEV_INITRD 248#ifdef CONFIG_BLK_DEV_INITRD
243 /* 249 /*
244 * If the initrd is in this node, reserve its memory. 250 * If the initrd is in this node, reserve its memory.
245 */ 251 */
246 if (node == initrd_node) { 252 if (node == initrd_node) {
247 reserve_bootmem_node(pgdat, phys_initrd_start, 253 int res = reserve_bootmem_node(pgdat, phys_initrd_start,
248 phys_initrd_size, BOOTMEM_DEFAULT); 254 phys_initrd_size, BOOTMEM_EXCLUSIVE);
249 initrd_start = __phys_to_virt(phys_initrd_start); 255
250 initrd_end = initrd_start + phys_initrd_size; 256 if (res == 0) {
257 initrd_start = __phys_to_virt(phys_initrd_start);
258 initrd_end = initrd_start + phys_initrd_size;
259 } else {
260 printk(KERN_ERR
261 "INITRD: 0x%08lx+0x%08lx overlaps in-use "
262 "memory region - disabling initrd\n",
263 phys_initrd_start, phys_initrd_size);
264 }
251 } 265 }
252#endif 266#endif
253 267
254 /* 268 /*
255 * Finally, reserve any node zero regions.
256 */
257 if (node == 0)
258 reserve_node_zero(pgdat);
259
260 /*
261 * initialise the zones within this node. 269 * initialise the zones within this node.
262 */ 270 */
263 memset(zone_size, 0, sizeof(zone_size)); 271 memset(zone_size, 0, sizeof(zone_size));