linux/fs/ntfs3
Tetsuo Handa 8414983c2e fs/ntfs3: don't hold ni_lock when calling truncate_setsize()
[ Upstream commit 0226635c30 ]

syzbot is reporting hung task at do_user_addr_fault() [1], for there is
a silent deadlock between PG_locked bit and ni_lock lock.

Since filemap_update_page() calls filemap_read_folio() after calling
folio_trylock() which will set PG_locked bit, ntfs_truncate() must not
call truncate_setsize() which will wait for PG_locked bit to be cleared
when holding ni_lock lock.

Link: https://lore.kernel.org/all/00000000000060d41f05f139aa44@google.com/
Link: https://syzkaller.appspot.com/bug?extid=bed15dbf10294aa4f2ae [1]
Reported-by: syzbot <syzbot+bed15dbf10294aa4f2ae@syzkaller.appspotmail.com>
Debugged-by: Linus Torvalds <torvalds@linux-foundation.org>
Co-developed-by: Hillf Danton <hdanton@sina.com>
Signed-off-by: Hillf Danton <hdanton@sina.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: 4342306f0f ("fs/ntfs3: Add file operations and implementation")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-01-12 11:59:15 +01:00
..
lib fs/ntfs3: Add missing header and guards to lib/ headers 2021-09-13 19:41:44 +03:00
attrib.c fs/ntfs3: Add null pointer check to attr_load_runs_vcn 2023-01-12 11:58:43 +01:00
attrlist.c fs/ntfs3: Validate data run offset 2023-01-12 11:58:43 +01:00
bitfunc.c fs/ntfs3: Remove a useless shadowing variable 2021-09-23 19:05:46 +03:00
bitmap.c fs/ntfs3: Use __GFP_NOWARN allocation at wnd_init() 2023-01-12 11:58:45 +01:00
debug.h fs/ntfs3. Add forward declarations for structs to debug.h 2021-09-13 19:41:43 +03:00
dir.c fs/ntfs3: Rework ntfs_utf16_to_nls 2021-10-11 19:28:04 +03:00
file.c fs/ntfs3: don't hold ni_lock when calling truncate_setsize() 2023-01-12 11:59:15 +01:00
frecord.c fs/ntfs3: Validate data run offset 2023-01-12 11:58:43 +01:00
fslog.c fs/ntfs3: Fix slab-out-of-bounds in r_page 2023-01-12 11:58:45 +01:00
fsntfs.c fs/ntfs3: Validate index root when initialize NTFS security 2023-01-12 11:58:45 +01:00
index.c fs/ntfs3: Validate buffer length while parsing index 2023-01-12 11:58:44 +01:00
inode.c fs/ntfs3: Delete duplicate condition in ntfs_read_mft() 2023-01-12 11:58:45 +01:00
Kconfig
lznt.c fs/ntfs3: Remove tabs before spaces from comment 2021-09-16 17:01:36 +03:00
Makefile
namei.c fs/ntfs3: Move ni_lock_dir and ni_unlock into ntfs_create_inode 2021-09-24 17:39:57 +03:00
ntfs_fs.h Fixed xfstests generic/016 generic/021 generic/022 generic/041 generic/274 generic/423, 2021-10-15 09:58:11 -04:00
ntfs.h fs/ntfs3: Change max hardlinks limit to 4000 2021-09-21 18:37:01 +03:00
record.c fs/ntfs3: Validate resident attribute name 2023-01-12 11:58:44 +01:00
run.c fs/ntfs3: Remove unneeded header files from c files 2021-09-13 19:41:46 +03:00
super.c fs/ntfs3: Use __GFP_NOWARN allocation at ntfs_fill_super() 2023-01-12 11:58:45 +01:00
upcase.c fs/ntfs3: Change right headers to upcase.c 2021-09-13 19:41:45 +03:00
xattr.c fs/ntfs3: Harden against integer overflows 2022-12-31 13:14:33 +01:00