From: Gao Xiang Date: Thu, 9 Jan 2025 05:05:14 +0000 (+0800) Subject: erofs-utils: mkfs: fix crash when failing to build tree X-Git-Tag: accepted/tizen/unified/20250610.081809~67 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3bd00bf7bd9aab03b1e7e0a36fe608719739ee09;p=platform%2Fupstream%2Ferofs-utils.git erofs-utils: mkfs: fix crash when failing to build tree 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 Fixes: 6a8e395ae4fd ("erofs-utils: fix up root inode for incremental builds") Signed-off-by: Gao Xiang Link: https://lore.kernel.org/r/20250109050514.3836023-1-hsiangkao@linux.alibaba.com --- diff --git a/mkfs/main.c b/mkfs/main.c index 0f6a32b..daea33d 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1439,6 +1439,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; } }