Re: [syzbot] task hung in exfat_write_inode
From: syzbot
Date: Thu Nov 30 2023 - 03:43:22 EST
For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.
***
Subject: task hung in exfat_write_inode
Author: lizhi.xu@xxxxxxxxxxxxx
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f9ff5644bcc0
diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index bfdfafe00993..4bdcdf126a21 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -132,14 +132,18 @@ int __exfat_truncate(struct inode *inode)
clu.dir += num_clusters;
clu.size -= num_clusters;
} else {
+ mutex_unlock(&sbi->s_lock);
while (num_clusters > 0) {
last_clu = clu.dir;
+ mutex_lock(&sbi->s_lock);
if (exfat_get_next_cluster(sb, &(clu.dir)))
return -EIO;
+ mutex_unlock(&sbi->s_lock);
num_clusters--;
clu.size--;
}
+ mutex_lock(&sbi->s_lock);
}
} else {
ei->flags = ALLOC_NO_FAT_CHAIN;