mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
fs/ntfs3: Additional check in ntfs_file_release
[ Upstream commit 031d6f608290c847ba6378322d0986d08d1a645a ] Reported-by: syzbot+8c652f14a0fde76ff11d@syzkaller.appspotmail.com Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
68b39c0765
commit
550ef40fa6
1 changed files with 8 additions and 1 deletions
|
@ -1173,7 +1173,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 we are last writer on the inode, drop the block reservation. */
|
||||||
if (sbi->options->prealloc &&
|
if (sbi->options->prealloc &&
|
||||||
((file->f_mode & FMODE_WRITE) &&
|
((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);
|
ni_lock(ni);
|
||||||
down_write(&ni->file.run_lock);
|
down_write(&ni->file.run_lock);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue