]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
init/main.c: add warning when file specified in rdinit is inaccessible
authorLillian Berry <lillian@star-ark.net>
Mon, 7 Jul 2025 09:14:11 +0000 (09:14 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 20 Jul 2025 02:08:26 +0000 (19:08 -0700)
Avoid silently ignoring the initramfs when the file specified in rdinit is
not usable.  This prints an error that clearly explains the issue (file
was not found, vs initramfs was not found).

Link: https://lkml.kernel.org/r/20250707091411.1412681-1-lillian@star-ark.net
Signed-off-by: Lillian Berry <lillian@star-ark.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
init/main.c

index 225a58279acd7ca15203af1e407b310bc2f315e7..e47984871775beeb16dfff8d3bafa2cee68fb85c 100644 (file)
@@ -1592,7 +1592,11 @@ static noinline void __init kernel_init_freeable(void)
         * check if there is an early userspace init.  If yes, let it do all
         * the work
         */
-       if (init_eaccess(ramdisk_execute_command) != 0) {
+       int ramdisk_command_access;
+       ramdisk_command_access = init_eaccess(ramdisk_execute_command);
+       if (ramdisk_command_access != 0) {
+               pr_warn("check access for rdinit=%s failed: %i, ignoring\n",
+                       ramdisk_execute_command, ramdisk_command_access);
                ramdisk_execute_command = NULL;
                prepare_namespace();
        }