summaryrefslogtreecommitdiff
path: root/fs/erofs
diff options
context:
space:
mode:
authorGao Xiang <hsiangkao@linux.alibaba.com>2025-12-29 17:29:47 +0800
committerSasha Levin <sashal@kernel.org>2026-03-04 07:21:23 -0500
commitd498bd168494ad4a4bce16192bfb9ce04ca19c9a (patch)
treedb840d6b9d60cf5124f9b91ca12693a6e97938d9 /fs/erofs
parent56e4a84220045b6af0f1efc11825b39217c7decf (diff)
erofs: fix incorrect early exits in volume label handling
[ Upstream commit 3afa4da38802a4cba1c23848a32284e7e57b831b ] 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") Cc: stable@kernel.org Reviewed-by: Hongbo Li <lihongbo22@huawei.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/erofs')
-rw-r--r--fs/erofs/super.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index b54083128e0f..ee37628ec99f 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 */