Skip to content

Commit 48021f9

Browse files
Shreyas Joshipmladek
authored andcommitted
printk: handle blank console arguments passed in.
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]>
1 parent 8ece3b3 commit 48021f9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/printk/printk.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,6 +2200,9 @@ static int __init console_setup(char *str)
22002200
char *s, *options, *brl_options = NULL;
22012201
int idx;
22022202

2203+
if (str[0] == 0)
2204+
return 1;
2205+
22032206
if (_braille_console_setup(&str, &brl_options))
22042207
return 1;
22052208

0 commit comments

Comments
 (0)