Skip to content

Commit f2c1f63

Browse files
Yongpeng Yangbrauner
authored andcommitted
exfat: check return value of sb_min_blocksize in exfat_read_boot_sector
sb_min_blocksize() may return 0. Check its return value to avoid accessing the filesystem super block when sb->s_blocksize is 0. Cc: stable@vger.kernel.org # v6.15 Fixes: 719c1e1 ("exfat: add super block operations") Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com> Link: https://patch.msgid.link/20251104125009.2111925-3-yangyongpeng.storage@gmail.com Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 63b5aa0 commit f2c1f63

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

fs/exfat/super.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,10 @@ static int exfat_read_boot_sector(struct super_block *sb)
433433
struct exfat_sb_info *sbi = EXFAT_SB(sb);
434434

435435
/* 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+
}
437440

438441
/* read boot sector */
439442
sbi->boot_bh = sb_bread(sb, 0);

0 commit comments

Comments
 (0)