[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231221045014.3986230-1-lizhi.xu@windriver.com>
Date: Thu, 21 Dec 2023 12:50:14 +0800
From: Lizhi Xu <lizhi.xu@...driver.com>
To: <syzbot+2f73ed585f115e98aee8@...kaller.appspotmail.com>
CC: <linux-kernel@...r.kernel.org>, <syzkaller-bugs@...glegroups.com>
Subject: task hung in exfat_write_inode
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f9ff5644bcc0
diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c
index 56b870d9cc0d..a40e0f5ca67c 100644
--- a/fs/exfat/fatent.c
+++ b/fs/exfat/fatent.c
@@ -149,7 +149,7 @@ static int __exfat_free_cluster(struct inode *inode, struct exfat_chain *p_chain
{
struct super_block *sb = inode->i_sb;
struct exfat_sb_info *sbi = EXFAT_SB(sb);
- int cur_cmap_i, next_cmap_i;
+ int cur_cmap_i, next_cmap_i, ei = 0;
unsigned int num_clusters = 0;
unsigned int clu;
@@ -176,8 +176,11 @@ static int __exfat_free_cluster(struct inode *inode, struct exfat_chain *p_chain
if (p_chain->flags == ALLOC_NO_FAT_CHAIN) {
unsigned int last_cluster = p_chain->dir + p_chain->size - 1;
+ printk("b dir: %u, s: %u, nc: %u\n", p_chain->dir, p_chain->size, num_clusters);
do {
bool sync = false;
+ if (ei > 100)
+ break;
if (clu < last_cluster)
next_cmap_i =
@@ -192,12 +195,17 @@ static int __exfat_free_cluster(struct inode *inode, struct exfat_chain *p_chain
exfat_clear_bitmap(inode, clu, (sync && IS_DIRSYNC(inode)));
clu++;
num_clusters++;
+ ei++;
} while (num_clusters < p_chain->size);
+ printk("e dir: %u, s: %u, nc: %u, e: %d\n", p_chain->dir, p_chain->size, num_clusters, ei);
} else {
+ printk("b2 dir: %u, s: %u, nc: %u\n", p_chain->dir, p_chain->size, num_clusters);
do {
bool sync = false;
unsigned int n_clu = clu;
int err = exfat_get_next_cluster(sb, &n_clu);
+ if (ei > 100)
+ break;
if (err || n_clu == EXFAT_EOF_CLUSTER)
sync = true;
@@ -213,10 +221,12 @@ static int __exfat_free_cluster(struct inode *inode, struct exfat_chain *p_chain
exfat_clear_bitmap(inode, clu, (sync && IS_DIRSYNC(inode)));
clu = n_clu;
num_clusters++;
+ ei++;
if (err)
goto dec_used_clus;
} while (clu != EXFAT_EOF_CLUSTER);
+ printk("e2 dir: %u, s: %u, nc: %u, e: %d\n", p_chain->dir, p_chain->size, num_clusters, ei);
}
dec_used_clus:
Powered by blists - more mailing lists