====================================================== WARNING: possible circular locking dependency detected 5.15.189-syzkaller #0 Not tainted ------------------------------------------------------ syz.2.1619/13735 is trying to acquire lock: ffff8880651f20b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x15b/0x1d0 fs/hfs/bfind.c:-1 but task is already holding lock: ffff88805cb280f8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xd7/0x1280 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){+.+.}-{3:3}: __mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 hfs_extend_file+0xd7/0x1280 fs/hfs/extent.c:397 hfs_bmap_reserve+0x103/0x420 fs/hfs/btree.c:231 __hfs_ext_write_extent+0x1fa/0x470 fs/hfs/extent.c:121 __hfs_ext_cache_extent+0x6b/0x9b0 fs/hfs/extent.c:174 hfs_ext_read_extent fs/hfs/extent.c:202 [inline] hfs_extend_file+0x313/0x1280 fs/hfs/extent.c:401 hfs_get_block+0x3d4/0xbd0 fs/hfs/extent.c:353 __block_write_begin_int+0x54e/0x15a0 fs/buffer.c:2012 __block_write_begin fs/buffer.c:2062 [inline] block_write_begin fs/buffer.c:2122 [inline] cont_write_begin+0x58a/0x7b0 fs/buffer.c:2471 hfs_write_begin+0x92/0xe0 fs/hfs/inode.c:59 cont_expand_zero fs/buffer.c:2398 [inline] cont_write_begin+0x26c/0x7b0 fs/buffer.c:2461 hfs_write_begin+0x92/0xe0 fs/hfs/inode.c:59 hfs_file_truncate+0x18f/0x9c0 fs/hfs/extent.c:494 hfs_inode_setattr+0x4ab/0x6f0 fs/hfs/inode.c:657 notify_change+0xbcd/0xee0 fs/attr.c:505 do_truncate+0x197/0x220 fs/open.c:65 do_sys_ftruncate+0x31b/0x3d0 fs/open.c:193 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (&tree->tree_lock/1){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 hfs_find_init+0x15b/0x1d0 fs/hfs/bfind.c:-1 hfs_ext_read_extent fs/hfs/extent.c:200 [inline] hfs_extend_file+0x2eb/0x1280 fs/hfs/extent.c:401 hfs_bmap_reserve+0x103/0x420 fs/hfs/btree.c:231 hfs_cat_create+0x1c0/0x8d0 fs/hfs/catalog.c:104 hfs_mkdir+0x68/0xe0 fs/hfs/dir.c:232 vfs_mkdir+0x387/0x570 fs/namei.c:4065 do_mkdirat+0x1d7/0x5a0 fs/namei.c:4090 __do_sys_mkdirat fs/namei.c:4105 [inline] __se_sys_mkdirat fs/namei.c:4103 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4103 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 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.2.1619/13735: #0: ffff888024f10460 (sb_writers#16){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:377 #1: ffff88805cb29628 (&type->i_mutex_dir_key#11/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:822 [inline] #1: ffff88805cb29628 (&type->i_mutex_dir_key#11/1){+.+.}-{3:3}, at: filename_create+0x1f2/0x450 fs/namei.c:3835 #2: ffff88807d5540b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfs_find_init+0x15b/0x1d0 fs/hfs/bfind.c:-1 #3: ffff88805cb280f8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xd7/0x1280 fs/hfs/extent.c:397 stack backtrace: CPU: 0 PID: 13735 Comm: syz.2.1619 Not tainted 5.15.189-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Call Trace: dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106 check_noncircular+0x274/0x310 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 hfs_find_init+0x15b/0x1d0 fs/hfs/bfind.c:-1 hfs_ext_read_extent fs/hfs/extent.c:200 [inline] hfs_extend_file+0x2eb/0x1280 fs/hfs/extent.c:401 hfs_bmap_reserve+0x103/0x420 fs/hfs/btree.c:231 hfs_cat_create+0x1c0/0x8d0 fs/hfs/catalog.c:104 hfs_mkdir+0x68/0xe0 fs/hfs/dir.c:232 vfs_mkdir+0x387/0x570 fs/namei.c:4065 do_mkdirat+0x1d7/0x5a0 fs/namei.c:4090 __do_sys_mkdirat fs/namei.c:4105 [inline] __se_sys_mkdirat fs/namei.c:4103 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4103 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f87ac48a457 Code: 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 02 01 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f87aa6d1e68 EFLAGS: 00000246 ORIG_RAX: 0000000000000102 RAX: ffffffffffffffda RBX: 00007f87aa6d1ef0 RCX: 00007f87ac48a457 RDX: 00000000000001ff RSI: 0000200000000040 RDI: 00000000ffffff9c RBP: 0000200000000140 R08: 00002000000000c0 R09: 0000000000000000 R10: 0000200000000140 R11: 0000000000000246 R12: 0000200000000040 R13: 00007f87aa6d1eb0 R14: 0000000000000000 R15: 0000000000000000