summaryrefslogtreecommitdiff
path: root/fs/exfat
diff options
context:
space:
mode:
authorYongpeng Yang <yangyongpeng@xiaomi.com>2025-11-04 20:50:07 +0800
committerChristian Brauner <brauner@kernel.org>2025-11-05 14:00:16 +0100
commitf2c1f631630e01821fe4c3fdf6077bc7a8284f82 (patch)
tree206cc94645ad3d83fb23cb12cc94084c21bcf862 /fs/exfat
parent63b5aa01da0f38cdbd97d021477258e511631497 (diff)
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: 719c1e1829166d ("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>
Diffstat (limited to 'fs/exfat')
-rw-r--r--fs/exfat/super.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/exfat/super.c b/fs/exfat/super.c
index 7f9592856bf7..74d451f732c7 100644
--- a/fs/exfat/super.c
+++ b/fs/exfat/super.c
@@ -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);