====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc1-syzkaller-g2d8bce6e34be #0 Not tainted ------------------------------------------------------ syz.3.243/7391 is trying to acquire lock: ffff0000f7a840b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfsplus_find_init+0x144/0x1bc fs/hfsplus/bfind.c:28 but task is already holding lock: ffff0000da13b048 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x24c/0xa18 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+0x190/0x21a0 kernel/locking/mutex.c:608 __mutex_lock kernel/locking/mutex.c:752 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804 hfsplus_file_extend+0x1d0/0x1544 fs/hfsplus/extents.c:458 hfsplus_bmap_reserve+0xec/0x474 fs/hfsplus/btree.c:358 __hfsplus_ext_write_extent+0x1e8/0x4ac fs/hfsplus/extents.c:104 __hfsplus_ext_cache_extent+0x84/0xa84 fs/hfsplus/extents.c:186 hfsplus_ext_read_extent fs/hfsplus/extents.c:218 [inline] hfsplus_file_extend+0x39c/0x1544 fs/hfsplus/extents.c:462 hfsplus_get_block+0x398/0x1168 fs/hfsplus/extents.c:245 __block_write_begin_int+0x580/0x166c fs/buffer.c:2121 block_write_begin fs/buffer.c:2231 [inline] cont_write_begin+0x888/0xe44 fs/buffer.c:2582 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:46 generic_perform_write+0x29c/0x868 mm/filemap.c:4054 __generic_file_write_iter+0xfc/0x204 mm/filemap.c:4155 generic_file_write_iter+0xb8/0x2b4 mm/filemap.c:4181 new_sync_write fs/read_write.c:590 [inline] vfs_write+0x920/0xcf4 fs/read_write.c:683 ksys_write+0x15c/0x26c fs/read_write.c:736 __do_sys_write fs/read_write.c:748 [inline] __se_sys_write fs/read_write.c:745 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:745 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:732 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:750 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 -> #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+0x33f8/0x77c8 kernel/locking/lockdep.c:5202 lock_acquire+0x240/0x728 kernel/locking/lockdep.c:5825 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:608 __mutex_lock kernel/locking/mutex.c:752 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804 hfsplus_find_init+0x144/0x1bc fs/hfsplus/bfind.c:28 hfsplus_file_truncate+0x31c/0xa18 fs/hfsplus/extents.c:583 hfsplus_file_release+0x2a0/0x3a0 fs/hfsplus/inode.c:237 __fput+0x1bc/0x75c fs/file_table.c:431 ____fput+0x20/0x30 fs/file_table.c:459 task_work_run+0x230/0x2e0 kernel/task_work.c:228 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] do_notify_resume+0x178/0x1f4 arch/arm64/kernel/entry-common.c:151 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline] el0_svc+0xac/0x168 arch/arm64/kernel/entry-common.c:733 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:750 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 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 *** 2 locks held by syz.3.243/7391: #0: ffff0000da13b238 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:815 [inline] #0: ffff0000da13b238 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: hfsplus_file_release+0xe0/0x3a0 fs/hfsplus/inode.c:232 #1: ffff0000da13b048 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x24c/0xa18 fs/hfsplus/extents.c:577 stack backtrace: CPU: 1 UID: 0 PID: 7391 Comm: syz.3.243 Not tainted 6.12.0-rc1-syzkaller-g2d8bce6e34be #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:319 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:326 __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 print_circular_bug+0x154/0x1c0 kernel/locking/lockdep.c:2074 check_noncircular+0x310/0x404 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+0x33f8/0x77c8 kernel/locking/lockdep.c:5202 lock_acquire+0x240/0x728 kernel/locking/lockdep.c:5825 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:608 __mutex_lock kernel/locking/mutex.c:752 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804 hfsplus_find_init+0x144/0x1bc fs/hfsplus/bfind.c:28 hfsplus_file_truncate+0x31c/0xa18 fs/hfsplus/extents.c:583 hfsplus_file_release+0x2a0/0x3a0 fs/hfsplus/inode.c:237 __fput+0x1bc/0x75c fs/file_table.c:431 ____fput+0x20/0x30 fs/file_table.c:459 task_work_run+0x230/0x2e0 kernel/task_work.c:228 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] do_notify_resume+0x178/0x1f4 arch/arm64/kernel/entry-common.c:151 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline] el0_svc+0xac/0x168 arch/arm64/kernel/entry-common.c:733 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:750 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 hfsplus: unable to mark blocks free: error -4 hfsplus: can't free extent