Skip to content

Commit 9b61665

Browse files
committed
Merge: erofs: fix blksize < PAGE_SIZE for file-backed mounts
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/586 JIRA: https://issues.redhat.com/browse/RHEL-82421 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> Approved-by: Brian Foster <bfoster@redhat.com> Approved-by: Eric Sandeen <esandeen@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Julio Faracco <jfaracco@redhat.com>
2 parents d185673 + 27a51a4 commit 9b61665

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)