]> Git Repo - linux.git/commitdiff
printk: handle blank console arguments passed in.
authorShreyas Joshi <[email protected]>
Fri, 22 May 2020 06:53:06 +0000 (16:53 +1000)
committerPetr Mladek <[email protected]>
Fri, 22 May 2020 08:34:34 +0000 (10:34 +0200)
If uboot passes a blank string to console_setup then it results in
a trashed memory. Ultimately, the kernel crashes during freeing up
the memory.

This fix checks if there is a blank parameter being
passed to console_setup from uboot. In case it detects that
the console parameter is blank then it doesn't setup the serial
device and it gracefully exits.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Shreyas Joshi <[email protected]>
Acked-by: Sergey Senozhatsky <[email protected]>
[[email protected]: Better format the commit message and code, remove unnecessary brackets.]
Signed-off-by: Petr Mladek <[email protected]>
kernel/printk/printk.c

index 35cc5f54886030e630c8e3513f6aac998b8a31e2..a3990505abdf84c48715bddc6e7ea43b48c38725 100644 (file)
@@ -2200,6 +2200,9 @@ static int __init console_setup(char *str)
        char *s, *options, *brl_options = NULL;
        int idx;
 
+       if (str[0] == 0)
+               return 1;
+
        if (_braille_console_setup(&str, &brl_options))
                return 1;
 
This page took 0.09485 seconds and 4 git commands to generate.