Re: possible fix (linux-ntfs3)

From: syzbot
Date: Tue Sep 10 2024 - 02:52:31 EST


> #syz test: https://github.com/Paragon-Software-Group/linux-ntfs3.git master

This crash does not have a reproducer. I cannot test it.

>
> 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);
>