loop1: detected capacity change from 0 to 64 ====================================================== WARNING: possible circular locking dependency detected 6.1.119-syzkaller #0 Not tainted ------------------------------------------------------ syz.1.282/5536 is trying to acquire lock: ffff0000f53600b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x148/0x1c8 but task is already holding lock: ffff0000cf9700f8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_get_block+0x200/0x9e0 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}: __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 hfs_extend_file+0xe4/0x1130 fs/hfs/extent.c:397 hfs_bmap_reserve+0xd0/0x3b4 fs/hfs/btree.c:234 __hfs_ext_write_extent+0x1a0/0x468 fs/hfs/extent.c:121 __hfs_ext_cache_extent+0x84/0x754 fs/hfs/extent.c:174 hfs_ext_read_extent fs/hfs/extent.c:202 [inline] hfs_extend_file+0x29c/0x1130 fs/hfs/extent.c:401 hfs_get_block+0x3b8/0x9e0 fs/hfs/extent.c:353 __block_write_begin_int+0x340/0x13b4 fs/buffer.c:1991 __block_write_begin fs/buffer.c:2041 [inline] block_write_begin fs/buffer.c:2102 [inline] cont_write_begin+0x5c0/0x7d8 fs/buffer.c:2456 hfs_write_begin+0x98/0xe4 fs/hfs/inode.c:58 generic_perform_write+0x278/0x55c mm/filemap.c:3845 __generic_file_write_iter+0x168/0x388 mm/filemap.c:3973 generic_file_write_iter+0xb8/0x2b4 mm/filemap.c:4005 call_write_iter include/linux/fs.h:2265 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x610/0x91c fs/read_write.c:584 ksys_write+0x15c/0x26c fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:646 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 -> #0 (&tree->tree_lock/1){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain kernel/locking/lockdep.c:3825 [inline] __lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 hfs_find_init+0x148/0x1c8 hfs_ext_read_extent fs/hfs/extent.c:200 [inline] hfs_get_block+0x29c/0x9e0 fs/hfs/extent.c:366 block_read_full_folio+0x2f4/0x98c fs/buffer.c:2271 hfs_read_folio+0x28/0x38 fs/hfs/inode.c:39 filemap_read_folio+0x14c/0x39c mm/filemap.c:2489 do_read_cache_folio+0x24c/0x544 mm/filemap.c:3626 do_read_cache_page mm/filemap.c:3668 [inline] read_cache_page+0x6c/0x180 mm/filemap.c:3677 read_mapping_page include/linux/pagemap.h:791 [inline] __hfs_bnode_create+0x3dc/0x6d8 fs/hfs/bnode.c:290 hfs_bnode_find+0x1f8/0xdfc fs/hfs/bnode.c:335 hfs_brec_find+0x130/0x498 fs/hfs/bfind.c:126 hfs_brec_read+0x30/0x120 fs/hfs/bfind.c:165 hfs_cat_find_brec+0x124/0x3cc fs/hfs/catalog.c:194 hfs_fill_super+0xe00/0x13b4 fs/hfs/super.c:419 mount_bdev+0x274/0x370 fs/super.c:1443 hfs_mount+0x44/0x58 fs/hfs/super.c:456 legacy_get_tree+0xd4/0x16c fs/fs_context.c:632 vfs_get_tree+0x90/0x274 fs/super.c:1573 do_new_mount+0x278/0x8fc fs/namespace.c:3056 path_mount+0x590/0xe5c fs/namespace.c:3386 do_mount fs/namespace.c:3399 [inline] __do_sys_mount fs/namespace.c:3607 [inline] __se_sys_mount fs/namespace.c:3584 [inline] __arm64_sys_mount+0x45c/0x594 fs/namespace.c:3584 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 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 *** 3 locks held by syz.1.282/5536: #0: ffff0000f53fc0e0 (&type->s_umount_key#83/1){+.+.}-{3:3}, at: alloc_super+0x1b4/0x824 fs/super.c:228 #1: ffff0000f53620b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfs_find_init+0x148/0x1c8 #2: ffff0000cf9700f8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_get_block+0x200/0x9e0 fs/hfs/extent.c:365 stack backtrace: CPU: 1 PID: 5536 Comm: syz.1.282 Not tainted 6.1.119-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call trace: dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165 __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:2048 check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2170 check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain kernel/locking/lockdep.c:3825 [inline] __lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799 hfs_find_init+0x148/0x1c8 hfs_ext_read_extent fs/hfs/extent.c:200 [inline] hfs_get_block+0x29c/0x9e0 fs/hfs/extent.c:366 block_read_full_folio+0x2f4/0x98c fs/buffer.c:2271 hfs_read_folio+0x28/0x38 fs/hfs/inode.c:39 filemap_read_folio+0x14c/0x39c mm/filemap.c:2489 do_read_cache_folio+0x24c/0x544 mm/filemap.c:3626 do_read_cache_page mm/filemap.c:3668 [inline] read_cache_page+0x6c/0x180 mm/filemap.c:3677 read_mapping_page include/linux/pagemap.h:791 [inline] __hfs_bnode_create+0x3dc/0x6d8 fs/hfs/bnode.c:290 hfs_bnode_find+0x1f8/0xdfc fs/hfs/bnode.c:335 hfs_brec_find+0x130/0x498 fs/hfs/bfind.c:126 hfs_brec_read+0x30/0x120 fs/hfs/bfind.c:165 hfs_cat_find_brec+0x124/0x3cc fs/hfs/catalog.c:194 hfs_fill_super+0xe00/0x13b4 fs/hfs/super.c:419 mount_bdev+0x274/0x370 fs/super.c:1443 hfs_mount+0x44/0x58 fs/hfs/super.c:456 legacy_get_tree+0xd4/0x16c fs/fs_context.c:632 vfs_get_tree+0x90/0x274 fs/super.c:1573 do_new_mount+0x278/0x8fc fs/namespace.c:3056 path_mount+0x590/0xe5c fs/namespace.c:3386 do_mount fs/namespace.c:3399 [inline] __do_sys_mount fs/namespace.c:3607 [inline] __se_sys_mount fs/namespace.c:3584 [inline] __arm64_sys_mount+0x45c/0x594 fs/namespace.c:3584 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 hfs: get root inode failed