====================================================== WARNING: possible circular locking dependency detected 6.17.0-rc1-syzkaller-g8f5ae30d69d7 #0 Not tainted ------------------------------------------------------ syz.6.388/8893 is trying to acquire lock: ffff0001026f00b0 (&tree->tree_lock/1){+.+.}-{4:4}, at: hfs_find_init+0x15c/0x1d8 fs/hfs/bfind.c:-1 but task is already holding lock: ffff0000fdaca178 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xd4/0xf4c fs/hfs/extent.c:397 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}: __mutex_lock_common+0x1d0/0x24ac kernel/locking/mutex.c:598 __mutex_lock kernel/locking/mutex.c:760 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:812 hfs_extend_file+0xd4/0xf4c fs/hfs/extent.c:397 hfs_bmap_reserve+0xd4/0x3e0 fs/hfs/btree.c:269 __hfs_ext_write_extent+0x19c/0x488 fs/hfs/extent.c:121 __hfs_ext_cache_extent+0x84/0x750 fs/hfs/extent.c:174 hfs_ext_read_extent fs/hfs/extent.c:202 [inline] hfs_extend_file+0x264/0xf4c fs/hfs/extent.c:401 hfs_get_block+0x2e8/0x9cc fs/hfs/extent.c:353 __block_write_begin_int+0x53c/0x15e8 fs/buffer.c:2145 block_write_begin fs/buffer.c:2256 [inline] cont_write_begin+0x62c/0x968 fs/buffer.c:2594 hfs_write_begin+0x7c/0xc4 fs/hfs/inode.c:52 cont_expand_zero fs/buffer.c:2522 [inline] cont_write_begin+0x26c/0x968 fs/buffer.c:2584 hfs_write_begin+0x7c/0xc4 fs/hfs/inode.c:52 generic_perform_write+0x244/0x7bc mm/filemap.c:4175 __generic_file_write_iter+0xfc/0x204 mm/filemap.c:4292 generic_file_write_iter+0x10c/0x47c mm/filemap.c:4318 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x540/0xa3c fs/read_write.c:686 ksys_pwrite64 fs/read_write.c:793 [inline] __do_sys_pwrite64 fs/read_write.c:801 [inline] __se_sys_pwrite64 fs/read_write.c:798 [inline] __arm64_sys_pwrite64+0x170/0x208 fs/read_write.c:798 __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+0x58/0x180 arch/arm64/kernel/entry-common.c:879 el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:898 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596 -> #0 (&tree->tree_lock/1){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x1774/0x30a4 kernel/locking/lockdep.c:5237 lock_acquire+0x14c/0x2e0 kernel/locking/lockdep.c:5868 __mutex_lock_common+0x1d0/0x24ac kernel/locking/mutex.c:598 __mutex_lock kernel/locking/mutex.c:760 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:812 hfs_find_init+0x15c/0x1d8 fs/hfs/bfind.c:-1 hfs_ext_read_extent fs/hfs/extent.c:200 [inline] hfs_extend_file+0x238/0xf4c fs/hfs/extent.c:401 hfs_bmap_reserve+0xd4/0x3e0 fs/hfs/btree.c:269 hfs_cat_create+0x19c/0x590 fs/hfs/catalog.c:104 hfs_mkdir+0x6c/0xe4 fs/hfs/dir.c:232 vfs_mkdir+0x284/0x424 fs/namei.c:4366 do_mkdirat+0x1f8/0x4c8 fs/namei.c:4399 __do_sys_mkdirat fs/namei.c:4416 [inline] __se_sys_mkdirat fs/namei.c:4414 [inline] __arm64_sys_mkdirat+0x8c/0xa4 fs/namei.c:4414 __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+0x58/0x180 arch/arm64/kernel/entry-common.c:879 el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:898 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock/1); lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock/1); *** DEADLOCK *** 4 locks held by syz.6.388/8893: #0: ffff0000cf70c428 (sb_writers#21){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:557 #1: ffff0000fdacb020 (&type->i_mutex_dir_key#14/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:914 [inline] #1: ffff0000fdacb020 (&type->i_mutex_dir_key#14/1){+.+.}-{4:4}, at: filename_create+0x1ac/0x32c fs/namei.c:4139 #2: ffff0001026f20b0 (&tree->tree_lock){+.+.}-{4:4}, at: hfs_find_init+0x15c/0x1d8 fs/hfs/bfind.c:-1 #3: ffff0000fdaca178 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xd4/0xf4c fs/hfs/extent.c:397 stack backtrace: CPU: 1 UID: 0 PID: 8893 Comm: syz.6.388 Not tainted 6.17.0-rc1-syzkaller-g8f5ae30d69d7 #0 PREEMPT Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/30/2025 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:499 (C) __dump_stack+0x30/0x40 lib/dump_stack.c:94 dump_stack_lvl+0xd8/0x12c lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 print_circular_bug+0x324/0x32c kernel/locking/lockdep.c:2043 check_noncircular+0x154/0x174 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x1774/0x30a4 kernel/locking/lockdep.c:5237 lock_acquire+0x14c/0x2e0 kernel/locking/lockdep.c:5868 __mutex_lock_common+0x1d0/0x24ac kernel/locking/mutex.c:598 __mutex_lock kernel/locking/mutex.c:760 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:812 hfs_find_init+0x15c/0x1d8 fs/hfs/bfind.c:-1 hfs_ext_read_extent fs/hfs/extent.c:200 [inline] hfs_extend_file+0x238/0xf4c fs/hfs/extent.c:401 hfs_bmap_reserve+0xd4/0x3e0 fs/hfs/btree.c:269 hfs_cat_create+0x19c/0x590 fs/hfs/catalog.c:104 hfs_mkdir+0x6c/0xe4 fs/hfs/dir.c:232 vfs_mkdir+0x284/0x424 fs/namei.c:4366 do_mkdirat+0x1f8/0x4c8 fs/namei.c:4399 __do_sys_mkdirat fs/namei.c:4416 [inline] __se_sys_mkdirat fs/namei.c:4414 [inline] __arm64_sys_mkdirat+0x8c/0xa4 fs/namei.c:4414 __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+0x58/0x180 arch/arm64/kernel/entry-common.c:879 el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:898 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596