Skip to content

Commit 27a51a4

Browse files
author
Ian Kent
committed
erofs: fix blksize < PAGE_SIZE for file-backed mounts
JIRA: https://issues.redhat.com/browse/RHEL-82421 Upstream status: Linus commit bae0854 Author: Hongzhen Luo <hongzhen@linux.alibaba.com> Date: Tue Oct 15 18:38:36 2024 +0800 erofs: fix blksize < PAGE_SIZE for file-backed mounts Adjust sb->s_blocksize{,_bits} directly for file-backed mounts when the fs block size is smaller than PAGE_SIZE. Previously, EROFS used sb_set_blocksize(), which caused a panic if bdev-backed mounts is not used. Fixes: fb17675 ("erofs: add file-backed mount support") Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com> Link: https://lore.kernel.org/r/20241015103836.3757438-1-hongzhen@linux.alibaba.com Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> CVE: CVE-2024-56750 Signed-off-by: Ian Kent <ikent@redhat.com>
1 parent d04512a commit 27a51a4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/erofs/super.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,11 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
631631
errorfc(fc, "unsupported blksize for fscache mode");
632632
return -EINVAL;
633633
}
634-
if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) {
634+
635+
if (erofs_is_fileio_mode(sbi)) {
636+
sb->s_blocksize = 1 << sbi->blkszbits;
637+
sb->s_blocksize_bits = sbi->blkszbits;
638+
} else if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) {
635639
errorfc(fc, "failed to set erofs blksize");
636640
return -EINVAL;
637641
}

0 commit comments

Comments
 (0)