mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] erofs: fix incorrect early exits for invalid metabox-enabled images
@ 2025-12-29  9:29 Gao Xiang
  2025-12-29  9:29 ` [PATCH 2/4] erofs: fix incorrect early exits in volume label handling Gao Xiang
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Gao Xiang @ 2025-12-29  9:29 UTC (permalink / raw)
  To: linux-erofs; +Cc: LKML, Gao Xiang

Crafted EROFS images with metadata compression enabled can trigger
incorrect early returns, leading to folio reference leaks.

However, this does not cause system crashes or other severe issues.

Fixes: 414091322c63 ("erofs: implement metadata compression")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 fs/erofs/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 937a215f626c..2e4d0ea2ffa1 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -330,12 +330,13 @@ static int erofs_read_superblock(struct super_block *sb)
 	}
 	sbi->packed_nid = le64_to_cpu(dsb->packed_nid);
 	if (erofs_sb_has_metabox(sbi)) {
+		ret = -EFSCORRUPTED;
 		if (sbi->sb_size <= offsetof(struct erofs_super_block,
 					     metabox_nid))
-			return -EFSCORRUPTED;
+			goto out;
 		sbi->metabox_nid = le64_to_cpu(dsb->metabox_nid);
 		if (sbi->metabox_nid & BIT_ULL(EROFS_DIRENT_NID_METABOX_BIT))
-			return -EFSCORRUPTED;	/* self-loop detection */
+			goto out;		/* self-loop detection */
 	}
 	sbi->inos = le64_to_cpu(dsb->inos);
 
-- 
2.43.5


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-01-22  9:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-29  9:29 [PATCH 1/4] erofs: fix incorrect early exits for invalid metabox-enabled images Gao Xiang
2025-12-29  9:29 ` [PATCH 2/4] erofs: fix incorrect early exits in volume label handling Gao Xiang
2026-01-22  9:07   ` Chao Yu
2025-12-29  9:29 ` [PATCH 3/4] erofs: unexport erofs_getxattr() Gao Xiang
2026-01-22  9:07   ` Chao Yu
2025-12-29  9:29 ` [PATCH 4/4] erofs: unexport erofs_xattr_prefix() Gao Xiang
2025-12-31  4:57   ` [PATCH v2 " Gao Xiang
2026-01-22  9:08     ` Chao Yu
2026-01-22  9:06 ` [PATCH 1/4] erofs: fix incorrect early exits for invalid metabox-enabled images Chao Yu
2026-01-22  9:17   ` Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®