Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1635706
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] initramfs: Always do fput() and load modules after rootfs populate |
| Date | 2017-05-04 14:50 +0200 |
| Message-ID | <tDomK-3tZ-21@gated-at.bofh.it> (permalink) |
| References | <tDlyx-1Fo-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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>
Signed-off-by: Stafford Horne <shorne@gmail.com>
---
init/initramfs.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/init/initramfs.c b/init/initramfs.c
index 981f286..3a68715 100644
--- 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);
--
2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[BUG] OpenRISC exec init fails, bisected to 0886551 ("initramfs: finish fput() before accessing any binary from initramfs") Stafford Horne <shorne@gmail.com> - 2017-05-04 09:20 +0200
Re: [BUG] OpenRISC exec init fails, bisected to 0886551 ("initramfs: finish fput() before accessing any binary from initramfs") Lokesh Vutla <lokeshvutla@ti.com> - 2017-05-04 09:50 +0200
Re: [BUG] OpenRISC exec init fails, bisected to 0886551 ("initramfs: finish fput() before accessing any binary from initramfs") Stafford Horne <shorne@gmail.com> - 2017-05-04 10:40 +0200
Re: [BUG] OpenRISC exec init fails, bisected to 0886551 ("initramfs: finish fput() before accessing any binary from initramfs") Lokesh Vutla <lokeshvutla@ti.com> - 2017-05-04 11:20 +0200
Re: [BUG] OpenRISC exec init fails, bisected to 0886551 ("initramfs: finish fput() before accessing any binary from initramfs") Stafford Horne <shorne@gmail.com> - 2017-05-04 11:50 +0200
[PATCH] initramfs: Always do fput() and load modules after rootfs populate Stafford Horne <shorne@gmail.com> - 2017-05-04 14:50 +0200
Re: [PATCH] initramfs: Always do fput() and load modules after rootfs populate Al Viro <viro@ZenIV.linux.org.uk> - 2017-05-04 20:50 +0200
Re: [PATCH] initramfs: Always do fput() and load modules after rootfs populate Stafford Horne <shorne@gmail.com> - 2017-05-05 09:50 +0200
Re: initramfs: Always do fput() and load modules after rootfs populate Stafford Horne <shorne@gmail.com> - 2017-05-06 10:20 +0200
Re: initramfs: Always do fput() and load modules after rootfs populate Stafford Horne <shorne@gmail.com> - 2017-05-06 10:30 +0200
csiph-web