====================================================== WARNING: possible circular locking dependency detected 5.15.156-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/5280 is trying to acquire lock: ffff88807d11b048 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_get_block+0x37f/0x14e0 fs/hfsplus/extents.c:260 but task is already holding lock: ffff88801fd0a0b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x146/0x1c0 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&tree->tree_lock){+.+.}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 hfsplus_file_truncate+0x864/0xb80 fs/hfsplus/extents.c:595 hfsplus_setattr+0x1b9/0x280 fs/hfsplus/inode.c:267 notify_change+0xc6d/0xf50 fs/attr.c:505 do_truncate+0x21c/0x300 fs/open.c:65 handle_truncate fs/namei.c:3265 [inline] do_open fs/namei.c:3612 [inline] path_openat+0x28a3/0x2f20 fs/namei.c:3742 do_filp_open+0x21c/0x460 fs/namei.c:3769 do_sys_openat2+0x13b/0x500 fs/open.c:1253 do_sys_open fs/open.c:1269 [inline] __do_sys_creat fs/open.c:1343 [inline] __se_sys_creat fs/open.c:1337 [inline] __x64_sys_creat+0x11f/0x160 fs/open.c:1337 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #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+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 hfsplus_get_block+0x37f/0x14e0 fs/hfsplus/extents.c:260 block_read_full_page+0x2f9/0xde0 fs/buffer.c:2290 do_read_cache_page+0x752/0x1040 read_mapping_page include/linux/pagemap.h:515 [inline] __hfs_bnode_create+0x4f2/0xbb0 fs/hfsplus/bnode.c:447 hfsplus_bnode_create+0x120/0x460 fs/hfsplus/bnode.c:587 hfsplus_bmap_alloc+0x63c/0x720 fs/hfsplus/btree.c:414 hfs_btree_inc_height+0x11a/0xdb0 fs/hfsplus/brec.c:475 hfsplus_brec_insert+0x776/0xdd0 fs/hfsplus/brec.c:148 hfsplus_create_cat+0x498/0x1ba0 fs/hfsplus/catalog.c:292 hfsplus_fill_super+0x13e6/0x1c90 fs/hfsplus/super.c:560 mount_bdev+0x2c9/0x3f0 fs/super.c:1387 legacy_get_tree+0xeb/0x180 fs/fs_context.c:611 vfs_get_tree+0x88/0x270 fs/super.c:1517 do_new_mount+0x2ba/0xb40 fs/namespace.c:3005 do_mount fs/namespace.c:3348 [inline] __do_sys_mount fs/namespace.c:3556 [inline] __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3533 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 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(&tree->tree_lock); lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock); lock(&HFSPLUS_I(inode)->extents_lock); *** DEADLOCK *** 3 locks held by syz-executor.1/5280: #0: ffff888078c520e0 (&type->s_umount_key#48/1){+.+.}-{3:3}, at: alloc_super+0x210/0x940 fs/super.c:229 #1: ffff88801e64f998 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_fill_super+0x1378/0x1c90 fs/hfsplus/super.c:553 #2: ffff88801fd0a0b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x146/0x1c0 stack backtrace: CPU: 0 PID: 5280 Comm: syz-executor.1 Not tainted 5.15.156-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2f8/0x3b0 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+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 hfsplus_get_block+0x37f/0x14e0 fs/hfsplus/extents.c:260 block_read_full_page+0x2f9/0xde0 fs/buffer.c:2290 do_read_cache_page+0x752/0x1040 read_mapping_page include/linux/pagemap.h:515 [inline] __hfs_bnode_create+0x4f2/0xbb0 fs/hfsplus/bnode.c:447 hfsplus_bnode_create+0x120/0x460 fs/hfsplus/bnode.c:587 hfsplus_bmap_alloc+0x63c/0x720 fs/hfsplus/btree.c:414 hfs_btree_inc_height+0x11a/0xdb0 fs/hfsplus/brec.c:475 hfsplus_brec_insert+0x776/0xdd0 fs/hfsplus/brec.c:148 hfsplus_create_cat+0x498/0x1ba0 fs/hfsplus/catalog.c:292 hfsplus_fill_super+0x13e6/0x1c90 fs/hfsplus/super.c:560 mount_bdev+0x2c9/0x3f0 fs/super.c:1387 legacy_get_tree+0xeb/0x180 fs/fs_context.c:611 vfs_get_tree+0x88/0x270 fs/super.c:1517 do_new_mount+0x2ba/0xb40 fs/namespace.c:3005 do_mount fs/namespace.c:3348 [inline] __do_sys_mount fs/namespace.c:3556 [inline] __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3533 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f4aae17a5aa Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 09 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007f4aac6eaef8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f4aac6eaf80 RCX: 00007f4aae17a5aa RDX: 0000000020000000 RSI: 0000000020000080 RDI: 00007f4aac6eaf40 RBP: 0000000020000000 R08: 00007f4aac6eaf80 R09: 0000000002000010 R10: 0000000002000010 R11: 0000000000000202 R12: 0000000020000080 R13: 00007f4aac6eaf40 R14: 0000000000000694 R15: 00000000200013c0