Patch "initramfs: Always do fput() and load modules after rootfs populate" has been added to the 4.11-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
initramfs: Always do fput() and load modules after rootfs populate
to the 4.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
initramfs-always-do-fput-and-load-modules-after-rootfs-populate.patch
and it can be found in the queue-4.11 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
17a9be31747535184f2af156b1f080ec4c92a952Mon Sep 17 00:00:00 2001
From: Stafford Horne <[email protected]>
Date: Thu, 4 May 2017 21:15:56 +0900
Subject: initramfs: Always do fput() and load modules after rootfs populate
From: Stafford Horne <[email protected]>
commit 17a9be31747535184f2af156b1f080ec4c92a952 upstream.
In OpenRISC we do not have a bootloader passed initrd, but the built in initramfs does contain the /init and other binaries, including modules. The previous commit 08865514805d2 ("initramfs: finish fput() before accessing any binary from initramfs") made a change to only call fput() if the bootloader initrd was available, this caused intermittent crashes for OpenRISC.
This patch changes the fput() to happen unconditionally if any rootfs is loaded. Also, I added some comments to make it a bit more clear why we call unpack_to_rootfs() multiple times.
--- init/initramfs.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
init/initramfs.c +9 -6
@@ -608,9 +608,11 @@ static void __init clean_rootfs(void)static int __init populate_rootfs (void ) { +/* Load the built in initramfs */ char *err =unpack_to_rootfs (__initramfs_start, __initramfs_size);if (err)panic ("%s" , err);/* Failed to decompress INTERNAL initramfs */ +/* If available load the bootloader supplied initrd */ if (initrd_start) {#ifdef CONFIG_BLK_DEV_RAM int fd;
@@ -648,13 +650,14 @@ static int __init populate_rootfs(void)printk (KERN_EMERG "Initramfs unpacking failed: %s\n" , err);free_initrd ();#endif -flush_delayed_fput (); -/* -* Try loading default modules from initramfs. This gives -* us a chance to load before device_initcalls. -*/ -load_default_modules (); } +flush_delayed_fput (); +/* +* Try loading default modules from initramfs. This gives +* us a chance to load before device_initcalls. +*/ +load_default_modules (); +return 0 ; }rootfs_initcall (populate_rootfs);
Patches currently in stable-queue which might be from [email protected] are
queue-4.11/initramfs-always-do-fput-and-load-modules-after-rootfs-populate.patch queue-4.11/initramfs-avoid-label-at-end-of-compound-statement-error.patch