All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "initramfs: Always do fput() and load modules after rootfs populate" has been added to the 4.11-stable tree
@ 2017-05-18  7:45 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-05-18  7:45 UTC (permalink / raw)
  To: shorne, gregkh, lokeshvutla, viro; +Cc: stable, stable-commits


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 <stable@vger.kernel.org> know about it.


>From 17a9be31747535184f2af156b1f080ec4c92a952 Mon Sep 17 00:00:00 2001
From: Stafford Horne <shorne@gmail.com>
Date: Thu, 4 May 2017 21:15:56 +0900
Subject: initramfs: Always do fput() and load modules after rootfs populate

From: Stafford Horne <shorne@gmail.com>

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.

Fixes: 08865514805d2 ("initramfs: finish fput() before accessing any binary from initramfs")
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Stafford Horne <shorne@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 init/initramfs.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -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 shorne@gmail.com 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-05-18  7:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-18  7:45 Patch "initramfs: Always do fput() and load modules after rootfs populate" has been added to the 4.11-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.