Commit 43341db1 authored by Namjae Jeon's avatar Namjae Jeon Committed by Zheng Zengkai
Browse files

exfat: handle wrong stream entry size in exfat_readdir()

stable inclusion
from stable-5.10.50
commit 5c6956e66404a7cf2def6947adc937a471716f17
bugzilla: 174522 https://gitee.com/openeuler/kernel/issues/I4DNFY

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5c6956e66404a7cf2def6947adc937a471716f17



--------------------------------

commit 1e5654de upstream.

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: ca061973 ("exfat: add directory operations")
Cc: stable@vger.kernel.org # v5.9
Reported-by: default avatarFlorian Cramer <flrncrmr@gmail.com>
Reviewed-by: default avatarSungjong Seo <sj1557.seo@samsung.com>
Tested-by: default avatarChris Down <chris@chrisdown.name>
Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Acked-by: default avatarWeilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 6c837d43
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment