OpenCloudOS-Kernel/fs/ntfs3
Tetsuo Handa 0226635c30 fs/ntfs3: don't hold ni_lock when calling truncate_setsize()
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>
2023-01-02 10:31:09 -08:00
..
lib fs/ntfs3: Add missing header and guards to lib/ headers 2021-09-13 19:41:44 +03:00
Kconfig
Makefile
attrib.c fs/ntfs3: Restore correct state after ENOSPC in attr_data_get_block 2022-11-14 19:50:46 +03:00
attrlist.c fs/ntfs3: Validate data run offset 2022-09-30 17:39:49 +03:00
bitfunc.c fs/ntfs3: Add ntfs_bitmap_weight_le function and refactoring 2022-11-14 19:50:42 +03:00
bitmap.c fs/ntfs3: Improve checking of bad clusters 2022-11-14 19:50:48 +03: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: Fix sparse problems 2022-11-14 19:50:42 +03:00
file.c fs/ntfs3: don't hold ni_lock when calling truncate_setsize() 2023-01-02 10:31:09 -08:00
frecord.c fs/ntfs3: Change new sparse cluster processing 2022-11-14 19:50:44 +03:00
fslog.c ntfs3 for 6.2 2022-12-21 10:18:17 -08:00
fsntfs.c fs/ntfs3: Use ALIGN kernel macro 2022-11-14 19:50:47 +03:00
index.c fs/ntfs3: Check fields while reading 2022-11-14 19:50:47 +03:00
inode.c ntfs3 for 6.2 2022-12-21 10:18:17 -08:00
lznt.c fs/ntfs3: Remove tabs before spaces from comment 2021-09-16 17:01:36 +03:00
namei.c ntfs3 for 6.2 2022-12-21 10:18:17 -08:00
ntfs.h fs/ntfs3: Fix wrong if in hdr_first_de 2022-11-14 19:50:48 +03:00
ntfs_fs.h ntfs3 for 6.2 2022-12-21 10:18:17 -08:00
record.c fs/ntfs3: Make if more readable 2022-11-14 19:50:49 +03:00
run.c fs/ntfs3: Improve checking of bad clusters 2022-11-14 19:50:48 +03:00
super.c fs/ntfs3: Improve checking of bad clusters 2022-11-14 19:50:48 +03:00
upcase.c fs/ntfs3: Add option "nocase" 2022-09-30 17:39:47 +03:00
xattr.c ntfs3 for 6.2 2022-12-21 10:18:17 -08:00