Re: [PATCH] exfat: skip FAT walk for out-of-range readdir offsets

From: Namjae Jeon

Date: Mon Nov 30 2026 - 05:40:51 EST


> @@ -90,6 +90,10 @@ static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_ent
> max_dentries = (unsigned int)min_t(u64, MAX_EXFAT_DENTRIES,
> exfat_cluster_to_dentries(sbi, sbi->num_clusters));
sbi->num_clusters includes the two reserved clusters. Please use
EXFAT_DATA_CLUSTER_COUNT(sbi).

>
> + /* Don't walk the FAT beyond the maximum dentry count. */
> + if (dentry >= max_dentries)
> + goto out;
exfat_bytes_to_dentries() has already narrowed the position to u32
here, so an out-of-range offset can appear to be a valid index.
Please compare *cpos against exfat_dentries_to_bytes(max_dentries)
before converting it to an index.

Thanks.