linux-stable/fs/exfat
Sungjong Seo 4b4b1f8dfe exfat: use updated exfat_chain directly during renaming
commit 204e6ceaa1 upstream.

In order for a file to access its own directory entry set,
exfat_inode_info(ei) has two copied values. One is ei->dir, which is
a snapshot of exfat_chain of the parent directory, and the other is
ei->entry, which is the offset of the start of the directory entry set
in the parent directory.

Since the parent directory can be updated after the snapshot point,
it should be used only for accessing one's own directory entry set.

However, as of now, during renaming, it could try to traverse or to
allocate clusters via snapshot values, it does not make sense.

This potential problem has been revealed when exfat_update_parent_info()
was removed by commit d8dad2588a ("exfat: fix referencing wrong parent
directory information after renaming"). However, I don't think it's good
idea to bring exfat_update_parent_info() back.

Instead, let's use the updated exfat_chain of parent directory diectly.

Fixes: d8dad2588a ("exfat: fix referencing wrong parent directory information after renaming")
Reported-by: Wang Yugui <wangyugui@e16-tech.com>
Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
Tested-by: Wang Yugui <wangyugui@e16-tech.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-29 17:25:30 +02:00
..
balloc.c exfat: check if cluster num is valid 2022-06-06 08:43:37 +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-04 09:33:00 +09:00
exfat_fs.h exfat: check if cluster num is valid 2022-06-06 08:43:37 +02:00
exfat_raw.h exfat: fix shift-out-of-bounds in exfat_fill_super() 2021-02-22 09:55:13 +09:00
fatent.c exfat: check if cluster num is valid 2022-06-06 08:43:37 +02:00
file.c exfat: fix i_blocks for files truncated over 4 GiB 2022-03-08 19:12:32 +01:00
inode.c exfat: fix i_blocks for files truncated over 4 GiB 2022-03-08 19:12:32 +01: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: use updated exfat_chain directly during renaming 2022-07-29 17:25:30 +02:00
nls.c exfat: Avoid allocating upcase table using kcalloc() 2020-12-22 12:31:17 +09:00
super.c exfat: fix i_blocks for files truncated over 4 GiB 2022-03-08 19:12:32 +01:00