]> git.baikalelectronics.ru Git - kernel.git/commit
param: fix crash on bad kernel arguments
authorDaniel Thompson <daniel.thompson@linaro.org>
Tue, 11 Nov 2014 05:59:46 +0000 (16:29 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 11 Nov 2014 06:33:19 +0000 (17:03 +1030)
commitdefc1c5ffdedda41cbf164b86f3a09fe75915807
tree36475a18712046cbc4104f24fd5ae2864d289405
parent5b69731116214c747dd19798112a990641d3723e
param: fix crash on bad kernel arguments

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 c777ce7bd287 ("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>
Cc: stable@vger.kernel.org
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
init/main.c