Commit 2d3145f8 authored by Linus Torvalds's avatar Linus Torvalds

early init: fix error handling when opening /dev/console

The comment says "this should never fail", but it definitely can fail
when you have odd initial boot filesystems, or kernel configurations.

So get the error handling right: filp_open() returns an error pointer.
Reported-by: default avatarJesse Barnes <jsbarnes@google.com>
Reported-by: default avataryouling 257 <youling257@gmail.com>
Fixes: 8243186f ("fs: remove ksys_dup()")
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 58d90a04
...@@ -1163,7 +1163,7 @@ void console_on_rootfs(void) ...@@ -1163,7 +1163,7 @@ void console_on_rootfs(void)
/* Open /dev/console in kernelspace, this should never fail */ /* Open /dev/console in kernelspace, this should never fail */
file = filp_open("/dev/console", O_RDWR, 0); file = filp_open("/dev/console", O_RDWR, 0);
if (!file) if (IS_ERR(file))
goto err_out; goto err_out;
/* create stdin/stdout/stderr, this should never fail */ /* create stdin/stdout/stderr, this should never fail */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment