[PATCH 1/3] initramfs: remove clean_rootfs

From: Christoph Hellwig
Date: Mon Jul 27 2020 - 12:08:05 EST


There is no point in trying to clean up after unpacking the initramfs
failed, as it should never get past the magic number check. In addition
d_genocide is actually the wrong thing to do here, it should have been
simple_recursive_remove().

Fixes: 38d014f6d446 ("initramfs: simplify clean_rootfs")
Reported-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
init/initramfs.c | 11 -----------
1 file changed, 11 deletions(-)

diff --git a/init/initramfs.c b/init/initramfs.c
index 3823d15e5d2619..50ec7e3c5389aa 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -576,16 +576,6 @@ static inline bool kexec_free_initrd(void)
#endif /* CONFIG_KEXEC_CORE */

#ifdef CONFIG_BLK_DEV_RAM
-static void __init clean_rootfs(void)
-{
- struct path path;
-
- if (kern_path("/", 0, &path))
- return;
- d_genocide(path.dentry);
- path_put(&path);
-}
-
static void __init populate_initrd_image(char *err)
{
ssize_t written;
@@ -625,7 +615,6 @@ static int __init populate_rootfs(void)
err = unpack_to_rootfs((char *)initrd_start, initrd_end - initrd_start);
if (err) {
#ifdef CONFIG_BLK_DEV_RAM
- clean_rootfs();
populate_initrd_image(err);
#else
printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
--
2.27.0