fs/ntfs3: Add ckeck in ni_update_parent()
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Fri, 30 Jun 2023 11:52:19 +0000 (15:52 +0400)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Thu, 28 Sep 2023 12:03:55 +0000 (15:03 +0300)
Check simple case when parent inode equals current inode.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/frecord.c

index 2b85cb1..d49fbb2 100644 (file)
@@ -3208,6 +3208,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)) {