summaryrefslogtreecommitdiffstats
path: root/kernel/params.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2015-08-26 09:42:34 +0930
committerRusty Russell <rusty@rustcorp.com.au>2015-08-26 10:36:19 +0930
commit74b22c465cd2b6ff4b8cec3997512ec807e6e495 (patch)
treebcc0db7d79b2b2c17f6f1cf3743a8eebbebdd7a9 /kernel/params.c
parent5cfb203a304deaaa8c7c5368722b214d24583137 (diff)
downloadop-kernel-dev-74b22c465cd2b6ff4b8cec3997512ec807e6e495.zip
op-kernel-dev-74b22c465cd2b6ff4b8cec3997512ec807e6e495.tar.gz
params: don't ignore the rest of cmdline if parse_one() fails
parse_args() just aborts after it hits an error, so other args at the same initcall level are simply ignored. This can lead to other hard-to-understand problems, for example my testing machine panics during the boot if I pass "locktorture.verbose=true". Change parse_args() to save the err code for return and continue. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel/params.c')
-rw-r--r--kernel/params.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/kernel/params.c b/kernel/params.c
index b6554aa..ed1e0a1 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -223,7 +223,7 @@ char *parse_args(const char *doing,
int (*unknown)(char *param, char *val,
const char *doing, void *arg))
{
- char *param, *val;
+ char *param, *val, *err = NULL;
/* Chew leading spaces */
args = skip_spaces(args);
@@ -238,7 +238,7 @@ char *parse_args(const char *doing,
args = next_arg(args, &param, &val);
/* Stop at -- */
if (!val && strcmp(param, "--") == 0)
- return args;
+ return err ?: args;
irq_was_disabled = irqs_disabled();
ret = parse_one(param, val, doing, params, num,
min_level, max_level, arg, unknown);
@@ -247,24 +247,25 @@ char *parse_args(const char *doing,
doing, param);
switch (ret) {
+ case 0:
+ continue;
case -ENOENT:
pr_err("%s: Unknown parameter `%s'\n", doing, param);
- return ERR_PTR(ret);
+ break;
case -ENOSPC:
pr_err("%s: `%s' too large for parameter `%s'\n",
doing, val ?: "", param);
- return ERR_PTR(ret);
- case 0:
break;
default:
pr_err("%s: `%s' invalid for parameter `%s'\n",
doing, val ?: "", param);
- return ERR_PTR(ret);
+ break;
}
+
+ err = ERR_PTR(ret);
}
- /* All parsed OK. */
- return NULL;
+ return err;
}
/* Lazy bastard, eh? */
OpenPOWER on IntegriCloud