[PATCH v2] erofs-utils: fix `-Ededupe` crash without fragments enabled

Jingbo Xu jefflexu at linux.alibaba.com
Sat May 6 13:53:06 AEST 2023


From: Gao Xiang <hsiangkao at linux.alibaba.com>

Otherwise, an unexpected segfault will happen since
  EROFS_FEATURE_INCOMPAT_FRAGMENTS and
  EROFS_FEATURE_INCOMPAT_DEDUPE    share the same bit.

Fixes: 18fbf7d12e4f ("erofs-utils: build xattrs upon extra long name prefixes")
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
Signed-off-by: Jingbo Xu <jefflexu at linux.alibaba.com>
---
v2: flush packed inode when either cfg.c_fragments or
cfg.c_extra_ea_name_prefixes is specified
---
 mkfs/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mkfs/main.c b/mkfs/main.c
index 467ea86..61387b3 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -903,7 +903,8 @@ int main(int argc, char **argv)
 	}
 
 	packed_nid = 0;
-	if (erofs_sb_has_fragments()) {
+	if ((cfg.c_fragments || cfg.c_extra_ea_name_prefixes) &&
+	    erofs_sb_has_fragments()) {
 		erofs_update_progressinfo("Handling packed_file ...");
 		packed_inode = erofs_mkfs_build_packedfile();
 		if (IS_ERR(packed_inode)) {
-- 
2.19.1.6.gb485710b



More information about the Linux-erofs mailing list