]> git.baikalelectronics.ru Git - kernel.git/commit
exfat: use updated exfat_chain directly during renaming
authorSungjong Seo <sj1557.seo@samsung.com>
Tue, 7 Jun 2022 15:05:21 +0000 (00:05 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jul 2022 15:25:30 +0000 (17:25 +0200)
commit01226e672d1448d122cab5f29fd43609e1b93d29
tree69e843c7e0d5ded2605e3a5849d303e068bf29c0
parent5310703762026c3e47ce2961dc4c7bb5480e38dc
exfat: use updated exfat_chain directly during renaming

commit e63a87fa5be336fa69e7bcb33e3c9ea25f4cc91f 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 e7ebf0fa07c1 ("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: e7ebf0fa07c1 ("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>
fs/exfat/namei.c