loop0: detected capacity change from 0 to 64 ====================================================== WARNING: possible circular locking dependency detected 6.1.20-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/21978 is trying to acquire lock: ffff88807a3060b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x16a/0x1e0 but task is already holding lock: ffff888054a78778 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_get_block+0x26b/0xb60 fs/hfs/extent.c:365 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}: lock_acquire+0x23a/0x630 kernel/locking/lockdep.c:5669 __mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799 hfs_extend_file+0xfb/0x1440 fs/hfs/extent.c:397 hfs_bmap_reserve+0xd5/0x3f0 fs/hfs/btree.c:234 __hfs_ext_write_extent+0x22e/0x4f0 fs/hfs/extent.c:121 __hfs_ext_cache_extent+0x6a/0x990 fs/hfs/extent.c:174 hfs_ext_read_extent fs/hfs/extent.c:202 [inline] hfs_extend_file+0x340/0x1440 fs/hfs/extent.c:401 hfs_get_block+0x3e0/0xb60 fs/hfs/extent.c:353 __block_write_begin_int+0x544/0x1a30 fs/buffer.c:1991 __block_write_begin fs/buffer.c:2041 [inline] block_write_begin+0x98/0x1f0 fs/buffer.c:2102 cont_write_begin+0x63f/0x880 fs/buffer.c:2456 hfs_write_begin+0x86/0xd0 fs/hfs/inode.c:58 generic_perform_write+0x2fc/0x5e0 mm/filemap.c:3754 __generic_file_write_iter+0x176/0x400 mm/filemap.c:3882 generic_file_write_iter+0xab/0x310 mm/filemap.c:3914 call_write_iter include/linux/fs.h:2205 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x7ae/0xba0 fs/read_write.c:584 ksys_write+0x19c/0x2c0 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&tree->tree_lock/1){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x23a/0x630 kernel/locking/lockdep.c:5669 __mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799 hfs_find_init+0x16a/0x1e0 hfs_ext_read_extent fs/hfs/extent.c:200 [inline] hfs_get_block+0x4f0/0xb60 fs/hfs/extent.c:366 block_read_full_folio+0x403/0xf60 fs/buffer.c:2271 filemap_read_folio+0x199/0x780 mm/filemap.c:2407 do_read_cache_folio+0x2ee/0x810 mm/filemap.c:3535 do_read_cache_page+0x32/0x220 mm/filemap.c:3577 read_mapping_page include/linux/pagemap.h:756 [inline] hfs_btree_open+0x507/0xf20 fs/hfs/btree.c:78 hfs_mdb_get+0x14c3/0x21b0 fs/hfs/mdb.c:204 hfs_fill_super+0x100c/0x1730 fs/hfs/super.c:406 mount_bdev+0x26d/0x3a0 fs/super.c:1414 legacy_get_tree+0xeb/0x180 fs/fs_context.c:610 vfs_get_tree+0x88/0x270 fs/super.c:1544 do_new_mount+0x28b/0xad0 fs/namespace.c:3040 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd 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 *** 2 locks held by syz-executor.0/21978: #0: ffff8880748a60e0 (&type->s_umount_key#53/1){+.+.}-{3:3}, at: alloc_super+0x217/0x930 fs/super.c:228 #1: ffff888054a78778 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_get_block+0x26b/0xb60 fs/hfs/extent.c:365 stack backtrace: CPU: 1 PID: 21978 Comm: syz-executor.0 Not tainted 6.1.20-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x23a/0x630 kernel/locking/lockdep.c:5669 __mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799 hfs_find_init+0x16a/0x1e0 hfs_ext_read_extent fs/hfs/extent.c:200 [inline] hfs_get_block+0x4f0/0xb60 fs/hfs/extent.c:366 block_read_full_folio+0x403/0xf60 fs/buffer.c:2271 filemap_read_folio+0x199/0x780 mm/filemap.c:2407 do_read_cache_folio+0x2ee/0x810 mm/filemap.c:3535 do_read_cache_page+0x32/0x220 mm/filemap.c:3577 read_mapping_page include/linux/pagemap.h:756 [inline] hfs_btree_open+0x507/0xf20 fs/hfs/btree.c:78 hfs_mdb_get+0x14c3/0x21b0 fs/hfs/mdb.c:204 hfs_fill_super+0x100c/0x1730 fs/hfs/super.c:406 mount_bdev+0x26d/0x3a0 fs/super.c:1414 legacy_get_tree+0xeb/0x180 fs/fs_context.c:610 vfs_get_tree+0x88/0x270 fs/super.c:1544 do_new_mount+0x28b/0xad0 fs/namespace.c:3040 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3568 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fe9e188d62a Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fe9e2669f88 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 000000000000028f RCX: 00007fe9e188d62a RDX: 00000000200000c0 RSI: 0000000020000140 RDI: 00007fe9e2669fe0 RBP: 00007fe9e266a020 R08: 00007fe9e266a020 R09: 000000000000840a R10: 000000000000840a R11: 0000000000000202 R12: 00000000200000c0 R13: 0000000020000140 R14: 00007fe9e2669fe0 R15: 00000000200004c0 hfs: unable to open catalog tree