lkml.org 
[lkml]   [2011]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] init: Carefuly handle loglevel option passed to kernel cmdline
From
Date
From: Alexander Sverdlin <alexander.sverdlin@sysgo.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@sysgo.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);




\
 
 \ /
  Last update: 2011-09-21 09:55    [W:0.274 / U:2.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site