summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorJan Beulich <JBeulich@novell.com>2005-09-13 01:25:12 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-13 08:22:28 -0700
commit0f3d2bd54f8fb178f516fc6903366e16e20f7428 (patch)
treebe457190729938d6f5f43d5c64e994ac4ea80424 /init
parenta1a5b3d93ca45613ec1d920fdb131b69b6553882 (diff)
downloadop-kernel-dev-0f3d2bd54f8fb178f516fc6903366e16e20f7428.zip
op-kernel-dev-0f3d2bd54f8fb178f516fc6903366e16e20f7428.tar.gz
[PATCH] free initrd mem adjustment
Besides freeing initrd memory, also clear out the now dangling pointers to it, to make sure accidental late use attempts can be detected. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'init')
-rw-r--r--init/initramfs.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/init/initramfs.c b/init/initramfs.c
index 02c5ce6..0c5d9a3 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -466,6 +466,14 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
extern char __initramfs_start[], __initramfs_end[];
#ifdef CONFIG_BLK_DEV_INITRD
#include <linux/initrd.h>
+
+static void __init free_initrd(void)
+{
+ free_initrd_mem(initrd_start, initrd_end);
+ initrd_start = 0;
+ initrd_end = 0;
+}
+
#endif
void __init populate_rootfs(void)
@@ -484,7 +492,7 @@ void __init populate_rootfs(void)
printk(" it is\n");
unpack_to_rootfs((char *)initrd_start,
initrd_end - initrd_start, 0);
- free_initrd_mem(initrd_start, initrd_end);
+ free_initrd();
return;
}
printk("it isn't (%s); looks like an initrd\n", err);
@@ -493,7 +501,7 @@ void __init populate_rootfs(void)
sys_write(fd, (char *)initrd_start,
initrd_end - initrd_start);
sys_close(fd);
- free_initrd_mem(initrd_start, initrd_end);
+ free_initrd();
}
}
#endif
OpenPOWER on IntegriCloud