Skip to content

Commit 031d6f6

Browse files
fs/ntfs3: Additional check in ntfs_file_release
Reported-by: syzbot+8c652f14a0fde76ff11d@syzkaller.appspotmail.com Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1 parent a33fb01 commit 031d6f6

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

fs/ntfs3/file.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,14 @@ static int ntfs_file_release(struct inode *inode, struct file *file)
13141314
/* If we are last writer on the inode, drop the block reservation. */
13151315
if (sbi->options->prealloc &&
13161316
((file->f_mode & FMODE_WRITE) &&
1317-
atomic_read(&inode->i_writecount) == 1)) {
1317+
atomic_read(&inode->i_writecount) == 1)
1318+
/*
1319+
* The only file when inode->i_fop = &ntfs_file_operations and
1320+
* init_rwsem(&ni->file.run_lock) is not called explicitly is MFT.
1321+
*
1322+
* Add additional check here.
1323+
*/
1324+
&& inode->i_ino != MFT_REC_MFT) {
13181325
ni_lock(ni);
13191326
down_write(&ni->file.run_lock);
13201327

0 commit comments

Comments
 (0)