====================================================== WARNING: possible circular locking dependency detected 6.16.0-rc4-syzkaller-g7482bb149b9f #0 Not tainted ------------------------------------------------------ syz.3.21/6755 is trying to acquire lock: ffff0000f9f578f8 (&sbi->alloc_mutex){+.+.}-{4:4}, at: hfsplus_block_allocate+0x88/0x70c fs/hfsplus/bitmap.c:35 but task is already holding lock: ffff0000e65c1548 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}, at: hfsplus_file_extend+0x1b8/0x1388 fs/hfsplus/extents.c:458 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}: __mutex_lock_common+0x1d0/0x2190 kernel/locking/mutex.c:602 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:799 hfsplus_get_block+0x2bc/0x1154 fs/hfsplus/extents.c:260 block_read_full_folio+0x2ec/0x824 fs/buffer.c:2427 hfsplus_read_folio+0x28/0x38 fs/hfsplus/inode.c:28 filemap_read_folio+0xec/0x2f8 mm/filemap.c:2412 do_read_cache_folio+0x364/0x5bc mm/filemap.c:3894 do_read_cache_page mm/filemap.c:3960 [inline] read_cache_page+0x6c/0x160 mm/filemap.c:3969 read_mapping_page include/linux/pagemap.h:966 [inline] hfsplus_block_allocate+0xdc/0x70c fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0x770/0x1388 fs/hfsplus/extents.c:469 hfsplus_get_block+0x314/0x1154 fs/hfsplus/extents.c:245 __block_write_begin_int+0x53c/0x15e8 fs/buffer.c:2151 block_write_begin fs/buffer.c:2262 [inline] cont_write_begin+0x62c/0x968 fs/buffer.c:2601 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:46 generic_perform_write+0x23c/0x79c mm/filemap.c:4112 __generic_file_write_iter+0xfc/0x204 mm/filemap.c:4229 generic_file_write_iter+0x104/0x470 mm/filemap.c:4255 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x62c/0x97c fs/read_write.c:686 ksys_write+0x120/0x210 fs/read_write.c:738 __do_sys_write fs/read_write.c:749 [inline] __se_sys_write fs/read_write.c:746 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:746 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x58/0x180 arch/arm64/kernel/entry-common.c:879 el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:898 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 -> #0 (&sbi->alloc_mutex){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3168 [inline] check_prevs_add kernel/locking/lockdep.c:3287 [inline] validate_chain kernel/locking/lockdep.c:3911 [inline] __lock_acquire+0x1774/0x30a4 kernel/locking/lockdep.c:5240 lock_acquire+0x14c/0x2e0 kernel/locking/lockdep.c:5871 __mutex_lock_common+0x1d0/0x2190 kernel/locking/mutex.c:602 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:799 hfsplus_block_allocate+0x88/0x70c fs/hfsplus/bitmap.c:35 hfsplus_file_extend+0x770/0x1388 fs/hfsplus/extents.c:469 hfsplus_bmap_reserve+0xe8/0x494 fs/hfsplus/btree.c:358 hfsplus_create_cat+0x170/0xdc8 fs/hfsplus/catalog.c:272 hfsplus_mknod+0x148/0x258 fs/hfsplus/dir.c:494 hfsplus_create+0x38/0x4c fs/hfsplus/dir.c:523 lookup_open fs/namei.c:3717 [inline] open_last_lookups fs/namei.c:3816 [inline] path_openat+0x12d8/0x2c40 fs/namei.c:4052 do_filp_open+0x18c/0x36c fs/namei.c:4082 do_sys_openat2+0x11c/0x1b4 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __arm64_sys_openat+0x120/0x158 fs/open.c:1463 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x58/0x180 arch/arm64/kernel/entry-common.c:879 el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:898 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFSPLUS_I(inode)->extents_lock); lock(&sbi->alloc_mutex); lock(&HFSPLUS_I(inode)->extents_lock); lock(&sbi->alloc_mutex); *** DEADLOCK *** 5 locks held by syz.3.21/6755: #0: ffff0000f9fa2428 (sb_writers#12){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:557 #1: ffff0000e65c2b78 (&type->i_mutex_dir_key#9){++++}-{4:4}, at: inode_lock include/linux/fs.h:869 [inline] #1: ffff0000e65c2b78 (&type->i_mutex_dir_key#9){++++}-{4:4}, at: open_last_lookups fs/namei.c:3813 [inline] #1: ffff0000e65c2b78 (&type->i_mutex_dir_key#9){++++}-{4:4}, at: path_openat+0x638/0x2c40 fs/namei.c:4052 #2: ffff0000f9f57998 (&sbi->vh_mutex){+.+.}-{4:4}, at: hfsplus_mknod+0x7c/0x258 fs/hfsplus/dir.c:486 #3: ffff0000cbe520b0 (&tree->tree_lock#2){+.+.}-{4:4}, at: hfsplus_find_init+0x144/0x1bc fs/hfsplus/bfind.c:28 #4: ffff0000e65c1548 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}, at: hfsplus_file_extend+0x1b8/0x1388 fs/hfsplus/extents.c:458 stack backtrace: CPU: 0 UID: 0 PID: 6755 Comm: syz.3.21 Not tainted 6.16.0-rc4-syzkaller-g7482bb149b9f #0 PREEMPT Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:501 (C) __dump_stack+0x30/0x40 lib/dump_stack.c:94 dump_stack_lvl+0xd8/0x12c lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 print_circular_bug+0x324/0x32c kernel/locking/lockdep.c:2046 check_noncircular+0x154/0x174 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3168 [inline] check_prevs_add kernel/locking/lockdep.c:3287 [inline] validate_chain kernel/locking/lockdep.c:3911 [inline] __lock_acquire+0x1774/0x30a4 kernel/locking/lockdep.c:5240 lock_acquire+0x14c/0x2e0 kernel/locking/lockdep.c:5871 __mutex_lock_common+0x1d0/0x2190 kernel/locking/mutex.c:602 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:799 hfsplus_block_allocate+0x88/0x70c fs/hfsplus/bitmap.c:35 hfsplus_file_extend+0x770/0x1388 fs/hfsplus/extents.c:469 hfsplus_bmap_reserve+0xe8/0x494 fs/hfsplus/btree.c:358 hfsplus_create_cat+0x170/0xdc8 fs/hfsplus/catalog.c:272 hfsplus_mknod+0x148/0x258 fs/hfsplus/dir.c:494 hfsplus_create+0x38/0x4c fs/hfsplus/dir.c:523 lookup_open fs/namei.c:3717 [inline] open_last_lookups fs/namei.c:3816 [inline] path_openat+0x12d8/0x2c40 fs/namei.c:4052 do_filp_open+0x18c/0x36c fs/namei.c:4082 do_sys_openat2+0x11c/0x1b4 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __arm64_sys_openat+0x120/0x158 fs/open.c:1463 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x58/0x180 arch/arm64/kernel/entry-common.c:879 el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:898 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600