summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2014-11-11 16:29:46 +1030
committerLuis Henriques <luis.henriques@canonical.com>2014-11-27 11:21:42 +0000
commitae72f1c1c2d0f55d342a53bcb8cb0aa57644caf0 (patch)
tree6a4018c1cab498ef5dab95b76d19b626b984173a /init
parent99b7b09019265e5a01cee2a560c2936600effc74 (diff)
downloadlinux-stable-ae72f1c1c2d0f55d342a53bcb8cb0aa57644caf0.tar.gz
linux-stable-ae72f1c1c2d0f55d342a53bcb8cb0aa57644caf0.tar.bz2
linux-stable-ae72f1c1c2d0f55d342a53bcb8cb0aa57644caf0.zip
param: fix crash on bad kernel arguments
commit 3438cf549d2f3ee8e52c82acc8e2a9710ac21a5b upstream. Currently if the user passes an invalid value on the kernel command line then the kernel will crash during argument parsing. On most systems this is very hard to debug because the console hasn't been initialized yet. This is a regression due to commit 51e158c12aca ("param: hand arguments after -- straight to init") which, in response to the systemd debug controversy, made it possible to explicitly pass arguments to init. To achieve this parse_args() was extended from simply returning an error code to returning a pointer. Regretably the new init args logic does not perform a proper validity check on the pointer resulting in a crash. This patch fixes the validity check. Should the check fail then no arguments will be passed to init. This is reasonable and matches how the kernel treats its own arguments (i.e. no error recovery). Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Diffstat (limited to 'init')
-rw-r--r--init/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/init/main.c b/init/main.c
index e8ae1fef0908..ed5f48edc7a8 100644
--- a/init/main.c
+++ b/init/main.c
@@ -544,7 +544,7 @@ asmlinkage __visible void __init start_kernel(void)
static_command_line, __start___param,
__stop___param - __start___param,
-1, -1, &unknown_bootoption);
- if (after_dashes)
+ if (!IS_ERR_OR_NULL(after_dashes))
parse_args("Setting init args", after_dashes, NULL, 0, -1, -1,
set_init_arg);