summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2023-06-30 15:52:19 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-08 17:26:46 +0100
commit59e629fc7157b26ece3ed7f766239c34da5e8280 (patch)
tree555912138d9150e7827c88afab9c7b35d05f3607
parent738a3adc7c8b3ea79f970c29fb2907d9b701167f (diff)
downloadlinux-59e629fc7157b26ece3ed7f766239c34da5e8280.tar.gz
linux-59e629fc7157b26ece3ed7f766239c34da5e8280.tar.bz2
linux-59e629fc7157b26ece3ed7f766239c34da5e8280.zip
fs/ntfs3: Add ckeck in ni_update_parent()
[ Upstream commit 87d1888aa40f25773fa0b948bcb2545f97e2cb15 ] Check simple case when parent inode equals current inode. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/ntfs3/frecord.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 9a1744955d1c..73a56d7ac84b 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -3144,6 +3144,12 @@ static bool ni_update_parent(struct ntfs_inode *ni, struct NTFS_DUP_INFO *dup,
if (!fname || !memcmp(&fname->dup, dup, sizeof(fname->dup)))
continue;
+ /* Check simple case when parent inode equals current inode. */
+ if (ino_get(&fname->home) == ni->vfs_inode.i_ino) {
+ ntfs_set_state(sbi, NTFS_DIRTY_ERROR);
+ continue;
+ }
+
/* ntfs_iget5 may sleep. */
dir = ntfs_iget5(sb, &fname->home, NULL);
if (IS_ERR(dir)) {