fs/ntfs3: Additional check in ntfs_file_release
PATCH 1/1 fs/ntfs3: Additional check in ntfs_file_release
From: Konstantin Komarov <[email protected]>
[ Upstream commit 031d6f608290c847ba6378322d0986d08d1a645a ]
Reported-by [email protected]
Signed-off-by Konstantin Komarov <[email protected]>
Signed-off-by Bin Lan <[email protected]>
--- fs/ntfs3/file.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/ntfs3/file.c +10 -2
@@ -1214,8 +1214,16 @@ static int ntfs_file_release(struct inode *inode, struct file *file)int err =0 ;/* 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 )) { +if (sbi->options->prealloc && + ((file->f_mode &FMODE_WRITE ) && +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);
Signature · 1 line
2.43.0