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@chrisdown.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