[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <507dee05e622cc37418b23e5de96b6b449410414.1730133890.git.chris@chrisdown.name>
Date: Mon, 28 Oct 2024 16:45:48 +0000
From: Chris Down <chris@...isdown.name>
To: Petr Mladek <pmladek@...e.com>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Tony Lindgren <tony.lindgren@...ux.intel.com>, kernel-team@...com
Subject: [PATCH v6 07/11] printk: Constrain hardware-addressed console checks
to name position
Commit 7640f1a44eba ("printk: Add
match_devname_and_update_preferred_console()") adds support for
DEVNAME:n:n style console= registration. It determines whether or not
this is a hardware-addressed console by looking at whether the console=
string has a colon in it. However, this interferes with loglevel:n and
potentially other future named options, which also make use of the
character.
In order to avoid this, only search positions before options.
Signed-off-by: Chris Down <chris@...isdown.name>
---
kernel/printk/printk.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index bc456f7624d4..bbd037b84a0d 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2670,6 +2670,7 @@ static int __init console_setup(char *str)
char *devname = NULL;
char *options;
char *s;
+ char *first_delim;
int idx;
/*
@@ -2685,8 +2686,13 @@ static int __init console_setup(char *str)
if (_braille_console_setup(&str, &brl_options))
return 1;
- /* For a DEVNAME:0.0 style console the character device is unknown early */
- if (strchr(str, ':'))
+ /*
+ * For a DEVNAME:0.0 style console the character device is unknown
+ * early. We must restrict this to before any comma to avoid interfering
+ * with named options, like "loglevel".
+ */
+ first_delim = strpbrk(str, ":,");
+ if (first_delim && *first_delim == ':')
devname = buf;
else
ttyname = buf;
--
2.46.0
Powered by blists - more mailing lists