[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1316591500.14570.7.camel@alex-vb>
Date: Wed, 21 Sep 2011 09:51:40 +0200
From: Alexander Sverdlin <asv@...go.com>
To: torvalds@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] init: Carefuly handle loglevel option passed to kernel
cmdline
From: Alexander Sverdlin <alexander.sverdlin@...go.com>
Carefuly handle loglevel option passed to kernel cmdline.
When malformed loglevel value (for example "${abc}") passed to kernel
cmdline, the loglevel itself is being set to 0. This suppresses all
following messages, including all the errors and crashes caused by
other malformed cmdline options. This could make debugging process
quite tricky. Provided modifications leaves previous value of loglevel
if the new value is incorrect and report error code in this case.
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@...go.com>
---
--- linux.old/init/main.c 2011-09-20 15:23:05.038279428 +0200
+++ linux/init/main.c 2011-09-21 09:39:24.266516051 +0200
@@ -209,8 +209,19 @@ early_param("quiet", quiet_kernel);
static int __init loglevel(char *str)
{
- get_option(&str, &console_loglevel);
- return 0;
+ int tmp_loglevel;
+
+ /*
+ * Only update loglevel value when correct setting was passed,
+ * to prevent blind crashes (when loglevel being set to 0) that
+ * are quite hard to debug
+ */
+ if (get_option(&str, &tmp_loglevel)) {
+ console_loglevel = tmp_loglevel;
+ return 0;
+ }
+
+ return -EINVAL;
}
early_param("loglevel", loglevel);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists