diff options
author | Ingo Molnar <mingo@kernel.org> | 2020-01-06 07:51:15 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2020-01-06 07:51:15 +0100 |
commit | 31c7ac388aa905a196ee16dff2015111f701f035 (patch) | |
tree | 09a43dde7fbf30ce57eaf5ba7ebda84da961538d /init | |
parent | Merge tag 'v5.5-rc4' into locking/kcsan, to resolve conflicts (diff) | |
parent | Linux 5.5-rc5 (diff) | |
download | linux-31c7ac388aa905a196ee16dff2015111f701f035.tar.xz linux-31c7ac388aa905a196ee16dff2015111f701f035.zip |
Merge tag 'v5.5-rc5' into locking/kcsan, to resolve conflict
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'init')
-rw-r--r-- | init/main.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/init/main.c b/init/main.c index 919f65faeb7e..e8fdfb7425a3 100644 --- a/init/main.c +++ b/init/main.c @@ -93,7 +93,6 @@ #include <linux/rodata_test.h> #include <linux/jump_label.h> #include <linux/mem_encrypt.h> -#include <linux/file.h> #include <linux/kcsan.h> #include <asm/io.h> @@ -1160,26 +1159,13 @@ static int __ref kernel_init(void *unused) void console_on_rootfs(void) { - struct file *file; - unsigned int i; - - /* Open /dev/console in kernelspace, this should never fail */ - file = filp_open("/dev/console", O_RDWR, 0); - if (IS_ERR(file)) - goto err_out; - - /* create stdin/stdout/stderr, this should never fail */ - for (i = 0; i < 3; i++) { - if (f_dupfd(i, file, 0) != i) - goto err_out; - } - - return; + /* Open the /dev/console as stdin, this should never fail */ + if (ksys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) + pr_err("Warning: unable to open an initial console.\n"); -err_out: - /* no panic -- this might not be fatal */ - pr_err("Warning: unable to open an initial console.\n"); - return; + /* create stdout/stderr */ + (void) ksys_dup(0); + (void) ksys_dup(0); } static noinline void __init kernel_init_freeable(void) |