[PATCH] erofs-utils: mkfs: fix crash when failing to build tree

Gao Xiang hsiangkao at linux.alibaba.com
Thu Jan 9 16:05:14 AEDT 2025


For example: It crashes instead of cleanly erroring out if there's
a file for which it doesn't have permissions to read (e.g. /etc/gshadow
has mode 000).

Reported-by: Jonathan Lebon <jonathan at jlebon.com>
Fixes: 6a8e395ae4fd ("erofs-utils: fix up root inode for incremental builds")
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 mkfs/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mkfs/main.c b/mkfs/main.c
index 2988c65..624b191 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1450,6 +1450,7 @@ int main(int argc, char **argv)
 		root = erofs_mkfs_build_tree_from_path(&g_sbi, cfg.c_src_path);
 		if (IS_ERR(root)) {
 			err = PTR_ERR(root);
+			root = NULL;
 			goto exit;
 		}
 	}
-- 
2.43.5



More information about the Linux-erofs mailing list