Re: [syzbot] [ntfs3?] possible deadlock in ntfs_file_mmap

Hillf Danton
2024-07-27T22:41:01Z

On Sat, 27 Jul 2024 06:44:20 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 2f8c4f506285 Merge tag 'auxdisplay-for-v6.11-tag1' of git:..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12e875a1980000

#syz test upstream 2f8c4f506285

--- x/fs/ntfs3/file.c
+++ y/fs/ntfs3/file.c
@@ -365,7 +365,10 @@ static int ntfs_file_mmap(struct file *f
}

if (ni->i_valid < to) {
- inode_lock(inode);
+ if (!inode_trylock(inode)) {
+ err = -EDEADLK;
+ goto out;
+ }
err = ntfs_extend_initialized_size(file, ni,
ni->i_valid, to);
inode_unlock(inode);
--