aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-02-18 04:54:41 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-02-18 04:54:41 -0800
commitf9d4cdfcaca93884ca6eda81ee1e0d0e9a6923b0 (patch)
tree45a662699d928000811bbc43af4a6fa35d2123ad /init
parent0ad0b87dfc18c3aaabddc580b8d2dad7faebf4d1 (diff)
downloadhistory-f9d4cdfcaca93884ca6eda81ee1e0d0e9a6923b0.tar.gz
[PATCH] defer panic for too many items in boot parameter line
From: Werner Almesberger <werner@almesberger.net> When passing too many unrecognized boot command line options (which become arguments or environment variables), the 2.6 kernel panics (unlike 2.4, which just ignores the extra items). Unfortunately, this happens before the console is initialized, so all you get is a kernel that dies quickly, for no apparent reason. This is particularly irritating if using UML with init=something wi th a lot of ar gu men t s The patch below delays the panic until after console_init. (akpm: I mainly added this in because we have other places where the panic-later-on machinery is needed).
Diffstat (limited to 'init')
-rw-r--r--init/main.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/init/main.c b/init/main.c
index 3ac9aef54f3179..f34e2a2069c555 100644
--- a/init/main.c
+++ b/init/main.c
@@ -141,6 +141,7 @@ __setup("maxcpus=", maxcpus);
static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
+static const char *panic_later, *panic_param;
__setup("profile=", profile_setup);
@@ -253,20 +254,27 @@ static int __init unknown_bootoption(char *param, char *val)
return 0;
}
+ if (panic_later)
+ return 0;
+
if (val) {
/* Environment option */
unsigned int i;
for (i = 0; envp_init[i]; i++) {
- if (i == MAX_INIT_ENVS)
- panic("Too many boot env vars at `%s'", param);
+ if (i == MAX_INIT_ENVS) {
+ panic_later = "Too many boot env vars at `%s'";
+ panic_param = param;
+ }
}
envp_init[i] = param;
} else {
/* Command line option */
unsigned int i;
for (i = 0; argv_init[i]; i++) {
- if (i == MAX_INIT_ARGS)
- panic("Too many boot init vars at `%s'",param);
+ if (i == MAX_INIT_ARGS) {
+ panic_later = "Too many boot init vars at `%s'";
+ panic_param = param;
+ }
}
argv_init[i] = param;
}
@@ -424,6 +432,8 @@ asmlinkage void __init start_kernel(void)
* this. But we do want output early, in case something goes wrong.
*/
console_init();
+ if (panic_later)
+ panic(panic_later, panic_param);
profile_init();
local_irq_enable();
#ifdef CONFIG_BLK_DEV_INITRD