Unverified Commit f2c1f631 authored by Yongpeng Yang's avatar Yongpeng Yang Committed by Christian Brauner
Browse files

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: 719c1e18 ("exfat: add super block operations")
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarYongpeng Yang <yangyongpeng@xiaomi.com>
Link: https://patch.msgid.link/20251104125009.2111925-3-yangyongpeng.storage@gmail.com


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 63b5aa01
Loading
Loading
Loading
Loading
+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);