Re: [syzbot] [exfat?] general protection fault in exfat_init_ext_entry
From: Yuezhang.Mo@xxxxxxxx
Date: Sun Dec 01 2024 - 21:00:15 EST
#syz testFrom c67f805c214c0be424ab37bed889746b9105472a Mon Sep 17 00:00:00 2001
From: Yuezhang Mo <Yuezhang.Mo@xxxxxxxx>
Date: Mon, 2 Dec 2024 09:53:17 +0800
Subject: [PATCH v1] exfat: fix error handling for exfat_find_empty_entry()
Signed-off-by: Yuezhang Mo <Yuezhang.Mo@xxxxxxxx>
---
fs/exfat/namei.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index ca616f2f2c8a..41d5090b237b 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -395,6 +395,9 @@ static int exfat_find_empty_entry(struct inode *inode,
inode->i_blocks += sbi->cluster_size >> 9;
}
+ if (dentry < 0)
+ return dentry;
+
p_dir->dir = exfat_sector_to_cluster(sbi, es->bh[0]->b_blocknr);
p_dir->size -= dentry / sbi->dentries_per_clu;
--
2.43.0