diff options
author | Jan Beulich <JBeulich@novell.com> | 2005-09-13 04:25:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-13 11:22:28 -0400 |
commit | 0f3d2bd54f8fb178f516fc6903366e16e20f7428 (patch) | |
tree | be457190729938d6f5f43d5c64e994ac4ea80424 /init | |
parent | a1a5b3d93ca45613ec1d920fdb131b69b6553882 (diff) |
[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.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/init/initramfs.c b/init/initramfs.c index 02c5ce64990d..0c5d9a3f951b 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) | |||
466 | extern char __initramfs_start[], __initramfs_end[]; | 466 | extern char __initramfs_start[], __initramfs_end[]; |
467 | #ifdef CONFIG_BLK_DEV_INITRD | 467 | #ifdef CONFIG_BLK_DEV_INITRD |
468 | #include <linux/initrd.h> | 468 | #include <linux/initrd.h> |
469 | |||
470 | static void __init free_initrd(void) | ||
471 | { | ||
472 | free_initrd_mem(initrd_start, initrd_end); | ||
473 | initrd_start = 0; | ||
474 | initrd_end = 0; | ||
475 | } | ||
476 | |||
469 | #endif | 477 | #endif |
470 | 478 | ||
471 | void __init populate_rootfs(void) | 479 | void __init populate_rootfs(void) |
@@ -484,7 +492,7 @@ void __init populate_rootfs(void) | |||
484 | printk(" it is\n"); | 492 | printk(" it is\n"); |
485 | unpack_to_rootfs((char *)initrd_start, | 493 | unpack_to_rootfs((char *)initrd_start, |
486 | initrd_end - initrd_start, 0); | 494 | initrd_end - initrd_start, 0); |
487 | free_initrd_mem(initrd_start, initrd_end); | 495 | free_initrd(); |
488 | return; | 496 | return; |
489 | } | 497 | } |
490 | printk("it isn't (%s); looks like an initrd\n", err); | 498 | printk("it isn't (%s); looks like an initrd\n", err); |
@@ -493,7 +501,7 @@ void __init populate_rootfs(void) | |||
493 | sys_write(fd, (char *)initrd_start, | 501 | sys_write(fd, (char *)initrd_start, |
494 | initrd_end - initrd_start); | 502 | initrd_end - initrd_start); |
495 | sys_close(fd); | 503 | sys_close(fd); |
496 | free_initrd_mem(initrd_start, initrd_end); | 504 | free_initrd(); |
497 | } | 505 | } |
498 | } | 506 | } |
499 | #endif | 507 | #endif |