mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
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>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -3423,8 +3423,8 @@ static inline void remove_inode_hash(struct inode *inode)
|
||||
extern void inode_sb_list_add(struct inode *inode);
|
||||
extern void inode_add_lru(struct inode *inode);
|
||||
|
||||
extern int sb_set_blocksize(struct super_block *, int);
|
||||
extern int sb_min_blocksize(struct super_block *, int);
|
||||
int sb_set_blocksize(struct super_block *sb, int size);
|
||||
int __must_check sb_min_blocksize(struct super_block *sb, int size);
|
||||
|
||||
int generic_file_mmap(struct file *, struct vm_area_struct *);
|
||||
int generic_file_mmap_prepare(struct vm_area_desc *desc);
|
||||
|
||||
Reference in New Issue
Block a user