[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241014035815.2247153-9-sashal@kernel.org>
Date: Sun, 13 Oct 2024 23:57:59 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Cc: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>,
syzbot+8c652f14a0fde76ff11d@...kaller.appspotmail.com,
Sasha Levin <sashal@...nel.org>,
ntfs3@...ts.linux.dev
Subject: [PATCH AUTOSEL 6.6 09/17] fs/ntfs3: Additional check in ntfs_file_release
From: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
[ Upstream commit 031d6f608290c847ba6378322d0986d08d1a645a ]
Reported-by: syzbot+8c652f14a0fde76ff11d@...kaller.appspotmail.com
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
fs/ntfs3/file.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index cd69cbd0aaae7..d05c433a55f35 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -1171,7 +1171,14 @@ static int ntfs_file_release(struct inode *inode, struct file *file)
/* If we are last writer on the inode, drop the block reservation. */
if (sbi->options->prealloc &&
((file->f_mode & FMODE_WRITE) &&
- atomic_read(&inode->i_writecount) == 1)) {
+ atomic_read(&inode->i_writecount) == 1)
+ /*
+ * The only file when inode->i_fop = &ntfs_file_operations and
+ * init_rwsem(&ni->file.run_lock) is not called explicitly is MFT.
+ *
+ * Add additional check here.
+ */
+ && inode->i_ino != MFT_REC_MFT) {
ni_lock(ni);
down_write(&ni->file.run_lock);
--
2.43.0
Powered by blists - more mailing lists