Skip to content

Commit 124af08

Browse files
Yongpeng Yangbrauner
authored andcommitted
xfs: check the return value of sb_min_blocksize() in xfs_fs_fill_super
sb_min_blocksize() may return 0. Check its return value to avoid the filesystem super block when sb->s_blocksize is 0. Cc: stable@vger.kernel.org # v6.15 Fixes: a64e5a5 ("bdev: add back PAGE_SIZE block size validation for sb_set_blocksize()") Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com> Link: https://patch.msgid.link/20251104125009.2111925-5-yangyongpeng.storage@gmail.com Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent e106e26 commit 124af08

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

fs/xfs/xfs_super.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,10 @@ xfs_fs_fill_super(
16621662
if (error)
16631663
return error;
16641664

1665-
sb_min_blocksize(sb, BBSIZE);
1665+
if (!sb_min_blocksize(sb, BBSIZE)) {
1666+
xfs_err(mp, "unable to set blocksize");
1667+
return -EINVAL;
1668+
}
16661669
sb->s_xattr = xfs_xattr_handlers;
16671670
sb->s_export_op = &xfs_export_operations;
16681671
#ifdef CONFIG_XFS_QUOTA

0 commit comments

Comments
 (0)