Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: Christian Brauner <brauner@kernel.org>

+21 -6
+1 -1
block/bdev.c
··· 231 231 232 232 EXPORT_SYMBOL(sb_set_blocksize); 233 233 234 - int sb_min_blocksize(struct super_block *sb, int size) 234 + int __must_check sb_min_blocksize(struct super_block *sb, int size) 235 235 { 236 236 int minsize = bdev_logical_block_size(sb->s_bdev); 237 237 if (size < minsize)
+4 -1
fs/exfat/super.c
··· 433 433 struct exfat_sb_info *sbi = EXFAT_SB(sb); 434 434 435 435 /* set block size to read super block */ 436 - sb_min_blocksize(sb, 512); 436 + if (!sb_min_blocksize(sb, 512)) { 437 + exfat_err(sb, "unable to set blocksize"); 438 + return -EINVAL; 439 + } 437 440 438 441 /* read boot sector */ 439 442 sbi->boot_bh = sb_bread(sb, 0);
+5 -1
fs/fat/inode.c
··· 1595 1595 1596 1596 setup(sb); /* flavour-specific stuff that needs options */ 1597 1597 1598 + error = -EINVAL; 1599 + if (!sb_min_blocksize(sb, 512)) { 1600 + fat_msg(sb, KERN_ERR, "unable to set blocksize"); 1601 + goto out_fail; 1602 + } 1598 1603 error = -EIO; 1599 - sb_min_blocksize(sb, 512); 1600 1604 bh = sb_bread(sb, 0); 1601 1605 if (bh == NULL) { 1602 1606 fat_msg(sb, KERN_ERR, "unable to read boot sector");
+5
fs/isofs/inode.c
··· 610 610 goto out_freesbi; 611 611 } 612 612 opt->blocksize = sb_min_blocksize(s, opt->blocksize); 613 + if (!opt->blocksize) { 614 + printk(KERN_ERR 615 + "ISOFS: unable to set blocksize\n"); 616 + goto out_freesbi; 617 + } 613 618 614 619 sbi->s_high_sierra = 0; /* default is iso9660 */ 615 620 sbi->s_session = opt->session;
+4 -1
fs/xfs/xfs_super.c
··· 1662 1662 if (error) 1663 1663 return error; 1664 1664 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 + } 1666 1669 sb->s_xattr = xfs_xattr_handlers; 1667 1670 sb->s_export_op = &xfs_export_operations; 1668 1671 #ifdef CONFIG_XFS_QUOTA
+2 -2
include/linux/fs.h
··· 3423 3423 extern void inode_sb_list_add(struct inode *inode); 3424 3424 extern void inode_add_lru(struct inode *inode); 3425 3425 3426 - extern int sb_set_blocksize(struct super_block *, int); 3427 - extern int sb_min_blocksize(struct super_block *, int); 3426 + int sb_set_blocksize(struct super_block *sb, int size); 3427 + int __must_check sb_min_blocksize(struct super_block *sb, int size); 3428 3428 3429 3429 int generic_file_mmap(struct file *, struct vm_area_struct *); 3430 3430 int generic_file_mmap_prepare(struct vm_area_desc *desc);