Description for this pull request:
- Improved compatibility issue with exfat from some camera vendors.
- Do not need to release root inode on error path.
exfat: handle wrong stream entry size in exfat_readdir()

The compatibility issue between linux exfat and exfat of some camera
company was reported from Florian. In their exfat, if the number of files
exceeds any limit, the DataLength in stream entry of the directory is
no longer updated. So some files created from camera does not show in
linux exfat. because linux exfat doesn't allow that cpos becomes larger
than DataLength of stream entry. This patch check DataLength in stream
entry only if the type is ALLOC_NO_FAT_CHAIN and add the check ensure
that dentry offset does not exceed max dentries size(256 MB) to avoid
the circular FAT chain issue.

Fixes: ca06197382bd ("exfat: add directory operations")
Cc: # v5.9
Reported-by: Florian Cramer <>
Reviewed-by: Sungjong Seo <>
Tested-by: Chris Down <>
Signed-off-by: Namjae Jeon <>
1 file changed