summaryrefslogtreecommitdiffstats
path: root/fs/ntfs3
diff options
context:
space:
mode:
authorKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2024-08-22 13:43:32 +0200
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2024-09-03 15:58:42 +0200
commit1fd21919de6de245b63066b8ee3cfba92e36f0e9 (patch)
treefe18534fefa1e12eb920a819e51ebad43f81012a /fs/ntfs3
parentfs/ntfs3: Refactor enum_rstbl to suppress static checker (diff)
downloadlinux-1fd21919de6de245b63066b8ee3cfba92e36f0e9.tar.xz
linux-1fd21919de6de245b63066b8ee3cfba92e36f0e9.zip
fs/ntfs3: Stale inode instead of bad
Fixed the logic of processing inode with wrong sequence number. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3')
-rw-r--r--fs/ntfs3/inode.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 6b0bdc474e76..56b6c4c6f528 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -536,11 +536,15 @@ struct inode *ntfs_iget5(struct super_block *sb, const struct MFT_REF *ref,
if (inode->i_state & I_NEW)
inode = ntfs_read_mft(inode, name, ref);
else if (ref->seq != ntfs_i(inode)->mi.mrec->seq) {
- /* Inode overlaps? */
- _ntfs_bad_inode(inode);
+ /*
+ * Sequence number is not expected.
+ * Looks like inode was reused but caller uses the old reference
+ */
+ iput(inode);
+ inode = ERR_PTR(-ESTALE);
}
- if (IS_ERR(inode) && name)
+ if (IS_ERR(inode))
ntfs_set_state(sb->s_fs_info, NTFS_DIRTY_ERROR);
return inode;