diff options
author | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2024-09-04 12:57:31 +0300 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2024-10-01 12:19:08 +0300 |
commit | 031d6f608290c847ba6378322d0986d08d1a645a (patch) | |
tree | 4a937d7c9c1e47acac1d14aa63c4f41ddbbcea27 /fs/ntfs3/file.c | |
parent | a33fb016e49e37aafab18dc3c8314d6399cb4727 (diff) |
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>
Diffstat (limited to 'fs/ntfs3/file.c')
-rw-r--r-- | fs/ntfs3/file.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index 4fdcb5177ea1..eb935d4180c0 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -1314,7 +1314,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); |