[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251229092949.2316075-2-hsiangkao@linux.alibaba.com>
Date: Mon, 29 Dec 2025 17:29:47 +0800
From: Gao Xiang <hsiangkao@...ux.alibaba.com>
To: linux-erofs@...ts.ozlabs.org
Cc: LKML <linux-kernel@...r.kernel.org>,
Gao Xiang <hsiangkao@...ux.alibaba.com>
Subject: [PATCH 2/4] erofs: fix incorrect early exits in volume label handling
Crafted EROFS images containing valid volume labels can trigger
incorrect early returns, leading to folio reference leaks.
However, this does not cause system crashes or other severe issues.
Fixes: 1cf12c717741 ("erofs: Add support for FS_IOC_GETFSLABEL")
Signed-off-by: Gao Xiang <hsiangkao@...ux.alibaba.com>
---
fs/erofs/super.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 2e4d0ea2ffa1..0d4f736ae1f1 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -347,8 +347,10 @@ static int erofs_read_superblock(struct super_block *sb)
if (dsb->volume_name[0]) {
sbi->volume_name = kstrndup(dsb->volume_name,
sizeof(dsb->volume_name), GFP_KERNEL);
- if (!sbi->volume_name)
- return -ENOMEM;
+ if (!sbi->volume_name) {
+ ret = -ENOMEM;
+ goto out;
+ }
}
/* parse on-disk compression configurations */
--
2.43.5
Powered by blists - more mailing lists