loop0: detected capacity change from 0 to 1024 ====================================================== WARNING: possible circular locking dependency detected 5.15.123-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor399/3961 is trying to acquire lock: ffff0000c8fb07c8 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x198/0x14e0 fs/hfsplus/extents.c:457 but task is already holding lock: ffff0000d6eda0b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x144/0x1bc which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&tree->tree_lock){+.+.}-{3:3}: __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743 hfsplus_file_truncate+0x6d4/0x9cc fs/hfsplus/extents.c:595 hfsplus_setattr+0x18c/0x25c fs/hfsplus/inode.c:267 notify_change+0xac4/0xd60 fs/attr.c:488 do_truncate+0x1c0/0x28c fs/open.c:65 handle_truncate fs/namei.c:3195 [inline] do_open fs/namei.c:3542 [inline] path_openat+0x20e8/0x26f0 fs/namei.c:3672 do_filp_open+0x1a8/0x3b4 fs/namei.c:3699 do_sys_openat2+0x128/0x3d8 fs/open.c:1211 __do_sys_openat2 fs/open.c:1266 [inline] __se_sys_openat2 fs/open.c:1246 [inline] __arm64_sys_openat2+0x2e8/0x370 fs/open.c:1246 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 -> #0 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{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:3787 [inline] __lock_acquire+0x32cc/0x7620 kernel/locking/lockdep.c:5011 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622 __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743 hfsplus_file_extend+0x198/0x14e0 fs/hfsplus/extents.c:457 hfsplus_bmap_reserve+0xec/0x474 fs/hfsplus/btree.c:357 hfsplus_rename_cat+0x1ac/0xf30 fs/hfsplus/catalog.c:456 hfsplus_rename+0x120/0x1b0 fs/hfsplus/dir.c:552 vfs_rename+0x8b8/0xd04 fs/namei.c:4742 do_renameat2+0x980/0x1040 fs/namei.c:4892 __do_sys_renameat2 fs/namei.c:4925 [inline] __se_sys_renameat2 fs/namei.c:4922 [inline] __arm64_sys_renameat2+0xe0/0xfc fs/namei.c:4922 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock); lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock); lock(&HFSPLUS_I(inode)->extents_lock); *** DEADLOCK *** 4 locks held by syz-executor399/3961: #0: ffff0000c8dfe460 (sb_writers#8){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:377 #1: ffff0000c8fb1e00 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:822 [inline] #1: ffff0000c8fb1e00 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: lock_rename+0xdc/0x198 fs/namei.c:2967 #2: ffff0000c8fb24c0 (&type->i_mutex_dir_key#6){++++}-{3:3}, at: inode_lock_nested include/linux/fs.h:822 [inline] #2: ffff0000c8fb24c0 (&type->i_mutex_dir_key#6){++++}-{3:3}, at: lock_two_inodes+0xdc/0x158 fs/inode.c:1063 #3: ffff0000d6eda0b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x144/0x1bc stack backtrace: CPU: 1 PID: 3961 Comm: syz-executor399 Not tainted 5.15.123-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023 Call trace: dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 dump_stack+0x1c/0x58 lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2011 check_noncircular+0x2cc/0x378 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:3787 [inline] __lock_acquire+0x32cc/0x7620 kernel/locking/lockdep.c:5011 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622 __mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743 hfsplus_file_extend+0x198/0x14e0 fs/hfsplus/extents.c:457 hfsplus_bmap_reserve+0xec/0x474 fs/hfsplus/btree.c:357 hfsplus_rename_cat+0x1ac/0xf30 fs/hfsplus/catalog.c:456 hfsplus_rename+0x120/0x1b0 fs/hfsplus/dir.c:552 vfs_rename+0x8b8/0xd04 fs/namei.c:4742 do_renameat2+0x980/0x1040 fs/namei.c:4892 __do_sys_renameat2 fs/namei.c:4925 [inline] __se_sys_renameat2 fs/namei.c:4922 [inline] __arm64_sys_renameat2+0xe0/0xfc fs/namei.c:4922 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584