+ initramfs-cleanup-incomplete-rootfs.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: initramfs: cleanup incomplete rootfs
has been added to the -mm tree.  Its filename is
     initramfs-cleanup-incomplete-rootfs.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/initramfs-cleanup-incomplete-rootfs.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/initramfs-cleanup-incomplete-rootfs.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: David Engraf <david.engraf@xxxxxxxxx>
Subject: initramfs: cleanup incomplete rootfs

Unpacking an external initrd may fail e.g.  not enough memory.  This leads
to an incomplete rootfs because some files might be extracted already. 
Fixed by cleaning the rootfs so the kernel is not using an incomplete
rootfs.

Link: http://lkml.kernel.org/r/20181030151805.5519-1-david.engraf@xxxxxxxxx
Signed-off-by: David Engraf <david.engraf@xxxxxxxxx>
Cc: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Philippe Ombredanne <pombredanne@xxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

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

--- a/init/initramfs.c~initramfs-cleanup-incomplete-rootfs
+++ a/init/initramfs.c
@@ -548,7 +548,6 @@ skip:
 	initrd_end = 0;
 }
 
-#ifdef CONFIG_BLK_DEV_RAM
 #define BUF_SIZE 1024
 static void __init clean_rootfs(void)
 {
@@ -595,7 +594,6 @@ static void __init clean_rootfs(void)
 	ksys_close(fd);
 	kfree(buf);
 }
-#endif
 
 static int __init populate_rootfs(void)
 {
@@ -638,8 +636,10 @@ static int __init populate_rootfs(void)
 		printk(KERN_INFO "Unpacking initramfs...\n");
 		err = unpack_to_rootfs((char *)initrd_start,
 			initrd_end - initrd_start);
-		if (err)
+		if (err) {
 			printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
+			clean_rootfs();
+		}
 		free_initrd();
 #endif
 	}
_

Patches currently in -mm which might be from david.engraf@xxxxxxxxx are

initramfs-cleanup-incomplete-rootfs.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux