linux-stable/fs/exfat
Namjae Jeon 5c6956e664 exfat: handle wrong stream entry size in exfat_readdir()
commit 1e5654de0f 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: ca06197382 ("exfat: add directory operations")
Cc: stable@vger.kernel.org # v5.9
Reported-by: Florian Cramer <flrncrmr@gmail.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Tested-by: Chris Down <chris@chrisdown.name>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-14 16:56:52 +02:00
..
balloc.c exfat: fix erroneous discard when clear cluster bit 2021-05-11 14:47:36 +02:00
cache.c exfat: fix use of uninitialized spinlock on error path 2020-10-07 14:27:13 +09:00
dir.c exfat: handle wrong stream entry size in exfat_readdir() 2021-07-14 16:56:52 +02:00
exfat_fs.h exfat: remove 'rwoffset' in exfat_inode_info 2020-10-22 08:29:11 +09:00
exfat_raw.h exfat: fix shift-out-of-bounds in exfat_fill_super() 2021-03-04 11:38:41 +01:00
fatent.c exfat: optimize exfat_zeroed_cluster() 2020-08-12 08:31:12 +09:00
file.c exfat: remove 'rwoffset' in exfat_inode_info 2020-10-22 08:29:11 +09:00
inode.c exfat: remove 'rwoffset' in exfat_inode_info 2020-10-22 08:29:11 +09:00
Kconfig exfat: Improve wording of EXFAT_DEFAULT_IOCHARSET config option 2020-06-09 16:48:39 +09:00
Makefile exfat: add Kconfig and Makefile 2020-03-05 21:00:40 -05:00
misc.c exfat: write multiple sectors at once 2020-08-12 08:31:11 +09:00
namei.c exfat: remove useless check in exfat_move_file() 2020-10-22 08:29:12 +09:00
nls.c exfat: Avoid allocating upcase table using kcalloc() 2020-12-26 16:02:38 +01:00
super.c exfat: fix shift-out-of-bounds in exfat_fill_super() 2021-03-04 11:38:41 +01:00