Unverified Commit 75fdd574 authored by Christian Brauner's avatar Christian Brauner
Browse files

Merge patch series "sb_min_blocksize() fixes"

Enforce checking of sb_min_blocksize() calls and update all callers
accordingly.

* patches from https://patch.msgid.link/20251104125009.2111925-2-yangyongpeng.storage@gmail.com:
  block: add __must_check attribute to sb_min_blocksize()
  xfs: check the return value of sb_min_blocksize() in xfs_fs_fill_super
  isofs: check the return value of sb_min_blocksize() in isofs_fill_super
  exfat: check return value of sb_min_blocksize in exfat_read_boot_sector
  vfat: fix missing sb_min_blocksize() return value checks

Link: https://patch.msgid.link/20251104125009.2111925-2-yangyongpeng.storage@gmail.com


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parents 90f601b4 8637fa89
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ int sb_set_blocksize(struct super_block *sb, int size)

EXPORT_SYMBOL(sb_set_blocksize);

int sb_min_blocksize(struct super_block *sb, int size)
int __must_check sb_min_blocksize(struct super_block *sb, int size)
{
	int minsize = bdev_logical_block_size(sb->s_bdev);
	if (size < minsize)
+4 −1
Original line number Diff line number Diff line
@@ -433,7 +433,10 @@ static int exfat_read_boot_sector(struct super_block *sb)
	struct exfat_sb_info *sbi = EXFAT_SB(sb);

	/* set block size to read super block */
	sb_min_blocksize(sb, 512);
	if (!sb_min_blocksize(sb, 512)) {
		exfat_err(sb, "unable to set blocksize");
		return -EINVAL;
	}

	/* read boot sector */
	sbi->boot_bh = sb_bread(sb, 0);
+5 −1
Original line number Diff line number Diff line
@@ -1595,8 +1595,12 @@ int fat_fill_super(struct super_block *sb, struct fs_context *fc,

	setup(sb); /* flavour-specific stuff that needs options */

	error = -EINVAL;
	if (!sb_min_blocksize(sb, 512)) {
		fat_msg(sb, KERN_ERR, "unable to set blocksize");
		goto out_fail;
	}
	error = -EIO;
	sb_min_blocksize(sb, 512);
	bh = sb_bread(sb, 0);
	if (bh == NULL) {
		fat_msg(sb, KERN_ERR, "unable to read boot sector");
+5 −0
Original line number Diff line number Diff line
@@ -610,6 +610,11 @@ static int isofs_fill_super(struct super_block *s, struct fs_context *fc)
		goto out_freesbi;
	}
	opt->blocksize = sb_min_blocksize(s, opt->blocksize);
	if (!opt->blocksize) {
		printk(KERN_ERR
		       "ISOFS: unable to set blocksize\n");
		goto out_freesbi;
	}

	sbi->s_high_sierra = 0; /* default is iso9660 */
	sbi->s_session = opt->session;
+4 −1
Original line number Diff line number Diff line
@@ -1662,7 +1662,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
Loading