diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c index 773c320d68f3..ab29c30ebaab 100644 --- a/fs/exfat/fatent.c +++ b/fs/exfat/fatent.c @@ -201,6 +201,8 @@ static int __exfat_free_cluster(struct inode *inode, struct exfat_chain *p_chain if (err || n_clu == EXFAT_EOF_CLUSTER) sync = true; + else if (num_clusters >= p_chain->size) + break; else next_cmap_i = BITMAP_OFFSET_SECTOR_INDEX(sb, CLUSTER_TO_BITMAP_ENT(n_clu));