mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 06:31:58 +02:00
gfs2: check sb_min_blocksize return value
Check the return value of sb_min_blocksize(): it will be 0 when the requested block size is invalid. In addition, check the return value of sb_set_blocksize() as well. Reported-by: syzbot+b0018b7468b2af33b4d5@syzkaller.appspotmail.com Signed-off-by: Edward Adam Davis <eadavis@qq.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
This commit is contained in:
parent
ae9f3bd825
commit
27d2f101e7
|
|
@ -489,7 +489,9 @@ static int init_sb(struct gfs2_sbd *sdp, int silent)
|
|||
sdp->sd_sb.sb_bsize, (unsigned int)PAGE_SIZE);
|
||||
goto out;
|
||||
}
|
||||
sb_set_blocksize(sb, sdp->sd_sb.sb_bsize);
|
||||
ret = -EINVAL;
|
||||
if (!sb_set_blocksize(sb, sdp->sd_sb.sb_bsize))
|
||||
goto out;
|
||||
|
||||
/* Get the root inode */
|
||||
no_addr = sdp->sd_sb.sb_root_dir.no_addr;
|
||||
|
|
@ -1158,6 +1160,9 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc)
|
|||
/* Set up the buffer cache and fill in some fake block size values
|
||||
to allow us to read-in the on-disk superblock. */
|
||||
sdp->sd_sb.sb_bsize = sb_min_blocksize(sb, 512);
|
||||
error = -EINVAL;
|
||||
if (!sdp->sd_sb.sb_bsize)
|
||||
goto fail_free;
|
||||
sdp->sd_sb.sb_bsize_shift = sb->s_blocksize_bits;
|
||||
sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift - 9;
|
||||
sdp->sd_fsb2bb = BIT(sdp->sd_fsb2bb_shift);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user