From: Yongpeng Yang Date: Tue, 4 Nov 2025 12:50:09 +0000 (+0800) Subject: xfs: check the return value of sb_min_blocksize() in xfs_fs_fill_super X-Git-Tag: v6.17.10~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=deb220e58973cb8b36de7cc6c91d68aa102aec11;p=thirdparty%2Fkernel%2Fstable.git xfs: check the return value of sb_min_blocksize() in xfs_fs_fill_super commit 124af0868ec6929ba838fb76d25f00c06ba8fc0d upstream. 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: a64e5a596067bd ("bdev: add back PAGE_SIZE block size validation for sb_set_blocksize()") Reviewed-by: Christoph Hellwig Signed-off-by: Yongpeng Yang Link: https://patch.msgid.link/20251104125009.2111925-5-yangyongpeng.storage@gmail.com Reviewed-by: Darrick J. Wong Signed-off-by: Christian Brauner Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 9a7dd3a36f74f..8fcafe6e5d3a3 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1710,7 +1710,10 @@ xfs_fs_fill_super( if (error) return error; - sb_min_blocksize(sb, BBSIZE); + if (!sb_min_blocksize(sb, BBSIZE)) { + xfs_err(mp, "unable to set blocksize"); + return -EINVAL; + } sb->s_xattr = xfs_xattr_handlers; sb->s_export_op = &xfs_export_operations; #ifdef CONFIG_XFS_QUOTA