====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc1-syzkaller-g0c559323bbaa #0 Not tainted ------------------------------------------------------ syz-executor.0/5528 is trying to acquire lock: ffff88810b2a60b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfsplus_find_init+0x17b/0x1f0 fs/hfsplus/bfind.c:28 but task is already holding lock: ffff88802a2e0108 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x204/0xb70 fs/hfsplus/extents.c:577 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 hfsplus_file_extend+0x1c1/0x1090 fs/hfsplus/extents.c:458 hfsplus_bmap_reserve+0x31c/0x410 fs/hfsplus/btree.c:358 __hfsplus_ext_write_extent+0x474/0x5e0 fs/hfsplus/extents.c:104 __hfsplus_ext_cache_extent+0x98/0x9d0 fs/hfsplus/extents.c:186 hfsplus_ext_read_extent+0x200/0x250 fs/hfsplus/extents.c:218 hfsplus_file_extend+0x699/0x1090 fs/hfsplus/extents.c:462 hfsplus_get_block+0x1ae/0x9e0 fs/hfsplus/extents.c:245 __block_write_begin_int+0x4fb/0x16e0 fs/buffer.c:2121 block_write_begin+0x9a/0x1d0 fs/buffer.c:2231 cont_write_begin+0x61d/0x950 fs/buffer.c:2582 hfsplus_write_begin+0x64/0x120 fs/hfsplus/inode.c:46 cont_expand_zero fs/buffer.c:2509 [inline] cont_write_begin+0x34e/0x950 fs/buffer.c:2572 hfsplus_write_begin+0x64/0x120 fs/hfsplus/inode.c:46 generic_cont_expand_simple+0x121/0x210 fs/buffer.c:2473 hfsplus_setattr+0x250/0x320 fs/hfsplus/inode.c:258 notify_change+0x6a6/0x1230 fs/attr.c:503 do_truncate+0x15c/0x220 fs/open.c:65 do_ftruncate+0x5d9/0x720 fs/open.c:181 do_sys_ftruncate+0x69/0xc0 fs/open.c:199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&tree->tree_lock/1){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x250b/0x3ce0 kernel/locking/lockdep.c:5202 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 hfsplus_find_init+0x17b/0x1f0 fs/hfsplus/bfind.c:28 hfsplus_file_truncate+0x2ab/0xb70 fs/hfsplus/extents.c:583 hfsplus_setattr+0x19f/0x320 fs/hfsplus/inode.c:264 notify_change+0x6a6/0x1230 fs/attr.c:503 do_truncate+0x15c/0x220 fs/open.c:65 do_ftruncate+0x5d9/0x720 fs/open.c:181 do_sys_ftruncate+0x69/0xc0 fs/open.c:199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 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 *** 3 locks held by syz-executor.0/5528: #0: ffff888107cca420 (sb_writers#14){.+.+}-{0:0}, at: do_sys_ftruncate+0x69/0xc0 fs/open.c:199 #1: ffff88802a2e02f8 (&sb->s_type->i_mutex_key#21){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:815 [inline] #1: ffff88802a2e02f8 (&sb->s_type->i_mutex_key#21){+.+.}-{3:3}, at: do_truncate+0x14b/0x220 fs/open.c:63 #2: ffff88802a2e0108 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x204/0xb70 fs/hfsplus/extents.c:577 stack backtrace: CPU: 1 UID: 0 PID: 5528 Comm: syz-executor.0 Not tainted 6.12.0-rc1-syzkaller-g0c559323bbaa #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x41c/0x610 kernel/locking/lockdep.c:2074 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x250b/0x3ce0 kernel/locking/lockdep.c:5202 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 hfsplus_find_init+0x17b/0x1f0 fs/hfsplus/bfind.c:28 hfsplus_file_truncate+0x2ab/0xb70 fs/hfsplus/extents.c:583 hfsplus_setattr+0x19f/0x320 fs/hfsplus/inode.c:264 notify_change+0x6a6/0x1230 fs/attr.c:503 do_truncate+0x15c/0x220 fs/open.c:65 do_ftruncate+0x5d9/0x720 fs/open.c:181 do_sys_ftruncate+0x69/0xc0 fs/open.c:199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f8e3767dda9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f8e383f80c8 EFLAGS: 00000246 ORIG_RAX: 000000000000004d RAX: ffffffffffffffda RBX: 00007f8e377abf80 RCX: 00007f8e3767dda9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000005 RBP: 00007f8e376ca47a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f8e377abf80 R15: 00007ffe5d4fec28