Skip to content

Commit 2e21557

Browse files
Chi Zhilingnamjaejeon
authored andcommitted
exfat: remove the check for infinite cluster chain loop
The infinite cluster chain loop check is not work because the loop will terminate when fclus reaches the parameter cluster, and the parameter cluster value is never greater than ei->valid_size. The following relationship holds: 'fclus' < 'cluster' ≤ ei->valid_size ≤ sb->num_clusters The check would only be triggered if a cluster number greater than sb->num_clusters is passed, but no caller currently does this. Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn> Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent 5e205c4 commit 2e21557

1 file changed

Lines changed: 0 additions & 10 deletions

File tree

fs/exfat/cache.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,6 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
238238
unsigned int *last_dclus, int allow_eof)
239239
{
240240
struct super_block *sb = inode->i_sb;
241-
struct exfat_sb_info *sbi = EXFAT_SB(sb);
242-
unsigned int limit = sbi->num_clusters;
243241
struct exfat_inode_info *ei = EXFAT_I(inode);
244242
struct exfat_cache_id cid;
245243
unsigned int content;
@@ -279,14 +277,6 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
279277
return 0;
280278

281279
while (*fclus < cluster) {
282-
/* prevent the infinite loop of cluster chain */
283-
if (*fclus > limit) {
284-
exfat_fs_error(sb,
285-
"detected the cluster chain loop (i_pos %u)",
286-
(*fclus));
287-
return -EIO;
288-
}
289-
290280
if (exfat_ent_get(sb, *dclus, &content, NULL))
291281
return -EIO;
292282

0 commit comments

Comments
 (0)