====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.3.342/6914 is trying to acquire lock: ffff8880529a20a8 (&tree->tree_lock/1){+.+.}-{4:4}, at: hfsplus_find_init+0x27c/0x410 fs/hfsplus/bfind.c:29 but task is already holding lock: ffff888057acacc0 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}, at: hfsplus_file_truncate+0x21e/0xd60 fs/hfsplus/extents.c:579 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x1a4/0x1bd0 kernel/locking/mutex.c:821 hfsplus_file_extend+0x1c9/0x1270 fs/hfsplus/extents.c:457 hfsplus_bmap_reserve+0x36a/0x4b0 fs/hfsplus/btree.c:512 __hfsplus_ext_write_extent+0x537/0x6d0 fs/hfsplus/extents.c:104 __hfsplus_ext_cache_extent+0x98/0x9d0 fs/hfsplus/extents.c:190 hfsplus_ext_read_extent+0x200/0x250 fs/hfsplus/extents.c:222 hfsplus_file_extend+0x79a/0x1270 fs/hfsplus/extents.c:461 hfsplus_get_block+0x1a9/0xab0 fs/hfsplus/extents.c:249 get_more_blocks fs/direct-io.c:644 [inline] do_direct_IO fs/direct-io.c:932 [inline] __blockdev_direct_IO+0x195e/0x3380 fs/direct-io.c:1236 blockdev_direct_IO include/linux/fs.h:3155 [inline] hfsplus_direct_IO+0x1ce/0x4b0 fs/hfsplus/inode.c:174 generic_file_direct_write+0x198/0x410 mm/filemap.c:4308 __generic_file_write_iter+0x11b/0x240 mm/filemap.c:4477 generic_file_write_iter+0xe1/0x390 mm/filemap.c:4517 do_iter_readv_writev+0x6f7/0x930 fs/read_write.c:828 vfs_writev+0x360/0xdd0 fs/read_write.c:1058 do_pwritev+0x1ac/0x270 fs/read_write.c:1154 __do_sys_pwritev2 fs/read_write.c:1212 [inline] __se_sys_pwritev2 fs/read_write.c:1203 [inline] __x64_sys_pwritev2+0xef/0x160 fs/read_write.c:1203 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&tree->tree_lock/1){+.+.}-{4:4}: check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x1a4/0x1bd0 kernel/locking/mutex.c:821 hfsplus_find_init+0x27c/0x410 fs/hfsplus/bfind.c:29 hfsplus_file_truncate+0x2cb/0xd60 fs/hfsplus/extents.c:585 hfsplus_delete_inode+0x194/0x230 fs/hfsplus/inode.c:553 hfsplus_unlink+0x79c/0x9a0 fs/hfsplus/dir.c:420 hfsplus_rename+0xbd/0x2a0 fs/hfsplus/dir.c:591 vfs_rename+0xc9f/0x2000 fs/namei.c:6208 filename_renameat2+0x754/0xa60 fs/namei.c:6326 __do_sys_rename fs/namei.c:6370 [inline] __se_sys_rename fs/namei.c:6366 [inline] __x64_sys_rename+0x81/0xb0 fs/namei.c:6366 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock/1); lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock/1); *** DEADLOCK *** locks held by syz.3.342/6914: 6, last CPU#0: #0: ffff88802be2c460 (sb_writers#15){.+.+}-{0:0}, at: filename_renameat2+0x3af/0xa60 fs/namei.c:6290 #1: ffff888057acda18 (&type->i_mutex_dir_key#10/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:1069 [inline] #1: ffff888057acda18 (&type->i_mutex_dir_key#10/1){+.+.}-{4:4}, at: lock_rename fs/namei.c:3785 [inline] #1: ffff888057acda18 (&type->i_mutex_dir_key#10/1){+.+.}-{4:4}, at: __start_renaming+0x43b/0x520 fs/namei.c:3878 #2: ffff888057aca818 (&sb->s_type->i_mutex_key#33){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:1024 [inline] #2: ffff888057aca818 (&sb->s_type->i_mutex_key#33){+.+.}-{4:4}, at: lock_two_nondirectories+0x188/0x1f0 fs/inode.c:1254 #3: ffff888057acae58 (&sb->s_type->i_mutex_key#33/4){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:1069 [inline] #3: ffff888057acae58 (&sb->s_type->i_mutex_key#33/4){+.+.}-{4:4}, at: lock_two_nondirectories+0xf3/0x1f0 fs/inode.c:1256 #4: ffff888050f69988 (&sbi->vh_mutex){+.+.}-{4:4}, at: hfsplus_unlink+0x198/0x9a0 fs/hfsplus/dir.c:385 #5: ffff888057acacc0 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}, at: hfsplus_file_truncate+0x21e/0xd60 fs/hfsplus/extents.c:579 stack backtrace: CPU: 0 UID: 0 PID: 6914 Comm: syz.3.342 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/05/2026 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_circular_bug.cold+0x178/0x1be kernel/locking/lockdep.c:2087 check_noncircular+0x146/0x160 kernel/locking/lockdep.c:2219 check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x1a4/0x1bd0 kernel/locking/mutex.c:821 hfsplus_find_init+0x27c/0x410 fs/hfsplus/bfind.c:29 hfsplus_file_truncate+0x2cb/0xd60 fs/hfsplus/extents.c:585 hfsplus_delete_inode+0x194/0x230 fs/hfsplus/inode.c:553 hfsplus_unlink+0x79c/0x9a0 fs/hfsplus/dir.c:420 hfsplus_rename+0xbd/0x2a0 fs/hfsplus/dir.c:591 vfs_rename+0xc9f/0x2000 fs/namei.c:6208 filename_renameat2+0x754/0xa60 fs/namei.c:6326 __do_sys_rename fs/namei.c:6370 [inline] __se_sys_rename fs/namei.c:6366 [inline] __x64_sys_rename+0x81/0xb0 fs/namei.c:6366 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7faadfb9e159 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007faae098a028 EFLAGS: 00000246 ORIG_RAX: 0000000000000052 RAX: ffffffffffffffda RBX: 00007faadfe25fa0 RCX: 00007faadfb9e159 RDX: 0000000000000000 RSI: 0000200000000240 RDI: 0000200000000200 RBP: 00007faadfc35024 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007faadfe26038 R14: 00007faadfe25fa0 R15: 00007ffce664da18 hfsplus: can't free extent: start 2889, count 1 hfsplus: found bad thread record in catalog hfsplus: found bad thread record in catalog hfsplus: found bad thread record in catalog