diff options
author | Shreyas Joshi <shreyas.joshi@biamp.com> | 2020-05-22 16:53:06 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-10-01 13:14:45 +0200 |
commit | c6a9585611a538466c8ad2421035c0ffa7fabc77 (patch) | |
tree | f2a77bad34ef025c516c11c7050cd328b75537c1 | |
parent | 39096c0f5c1ec9a3f9840ee315251493a607a57b (diff) | |
download | linux-stable-c6a9585611a538466c8ad2421035c0ffa7fabc77.tar.gz linux-stable-c6a9585611a538466c8ad2421035c0ffa7fabc77.tar.bz2 linux-stable-c6a9585611a538466c8ad2421035c0ffa7fabc77.zip |
printk: handle blank console arguments passed in.
[ Upstream commit 48021f98130880dd74286459a1ef48b5e9bc374f ]
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/20200522065306.83-1-shreyas.joshi@biamp.com
Signed-off-by: Shreyas Joshi <shreyas.joshi@biamp.com>
Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
[pmladek@suse.com: Better format the commit message and code, remove unnecessary brackets.]
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | kernel/printk/printk.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 3cb0e5b479ff..cf272aba362b 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2148,6 +2148,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; |