====================================================== WARNING: possible circular locking dependency detected 6.15.0-rc2-syzkaller-gc72692105976 #0 Not tainted ------------------------------------------------------ syz-executor/6496 is trying to acquire lock: ffff0000d204f8f8 (&sbi->alloc_mutex){+.+.}-{4:4}, at: hfsplus_block_free+0xb8/0x3f8 fs/hfsplus/bitmap.c:182 but task is already holding lock: ffff0000d4b9b048 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}, at: hfsplus_file_truncate+0x20c/0x970 fs/hfsplus/extents.c:577 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:601 __mutex_lock kernel/locking/mutex.c:746 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:798 hfsplus_get_block+0x2bc/0x1154 fs/hfsplus/extents.c:260 block_read_full_folio+0x2ec/0x824 fs/buffer.c:2392 hfsplus_read_folio+0x28/0x38 fs/hfsplus/inode.c:28 filemap_read_folio+0xec/0x2f8 mm/filemap.c:2400 do_read_cache_folio+0x368/0x5c0 mm/filemap.c:3884 do_read_cache_page mm/filemap.c:3950 [inline] read_cache_page+0x6c/0x160 mm/filemap.c:3959 read_mapping_page include/linux/pagemap.h:989 [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:2116 block_write_begin fs/buffer.c:2227 [inline] cont_write_begin+0x62c/0x968 fs/buffer.c:2566 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:46 cont_expand_zero fs/buffer.c:2493 [inline] cont_write_begin+0x26c/0x968 fs/buffer.c:2556 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:46 generic_perform_write+0x23c/0x79c mm/filemap.c:4102 __generic_file_write_iter+0xfc/0x204 mm/filemap.c:4219 generic_file_write_iter+0x104/0x470 mm/filemap.c:4245 new_sync_write fs/read_write.c:591 [inline] vfs_write+0x62c/0x97c fs/read_write.c:684 ksys_pwrite64 fs/read_write.c:791 [inline] __do_sys_pwrite64 fs/read_write.c:799 [inline] __se_sys_pwrite64 fs/read_write.c:796 [inline] __arm64_sys_pwrite64+0x170/0x208 fs/read_write.c:796 __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/0x150 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x78/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 -> #0 (&sbi->alloc_mutex){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3166 [inline] check_prevs_add kernel/locking/lockdep.c:3285 [inline] validate_chain kernel/locking/lockdep.c:3909 [inline] __lock_acquire+0x1728/0x3058 kernel/locking/lockdep.c:5235 lock_acquire+0x14c/0x2e0 kernel/locking/lockdep.c:5866 __mutex_lock_common+0x1d0/0x2190 kernel/locking/mutex.c:601 __mutex_lock kernel/locking/mutex.c:746 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:798 hfsplus_block_free+0xb8/0x3f8 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x14c/0x8d8 fs/hfsplus/extents.c:363 hfsplus_file_truncate+0x5e0/0x970 fs/hfsplus/extents.c:592 hfsplus_delete_inode+0x164/0x210 fs/hfsplus/inode.c:-1 hfsplus_unlink+0x404/0x63c fs/hfsplus/dir.c:405 vfs_unlink+0x2e0/0x520 fs/namei.c:4544 do_unlinkat+0x2b8/0x488 fs/namei.c:4608 __do_sys_unlinkat fs/namei.c:4649 [inline] __se_sys_unlinkat fs/namei.c:4642 [inline] __arm64_sys_unlinkat+0xdc/0xf8 fs/namei.c:4642 __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/0x150 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x78/0x108 arch/arm64/kernel/entry-common.c:762 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-executor/6496: #0: ffff0000d4a9a420 (sb_writers#11){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:556 #1: ffff0000d4b99df8 (&type->i_mutex_dir_key#8/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:902 [inline] #1: ffff0000d4b99df8 (&type->i_mutex_dir_key#8/1){+.+.}-{4:4}, at: do_unlinkat+0x190/0x488 fs/namei.c:4595 #2: ffff0000d4b9b238 (&sb->s_type->i_mutex_key#19){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:867 [inline] #2: ffff0000d4b9b238 (&sb->s_type->i_mutex_key#19){+.+.}-{4:4}, at: vfs_unlink+0xd0/0x520 fs/namei.c:4533 #3: ffff0000d204f998 (&sbi->vh_mutex){+.+.}-{4:4}, at: hfsplus_unlink+0x140/0x63c fs/hfsplus/dir.c:370 #4: ffff0000d4b9b048 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}, at: hfsplus_file_truncate+0x20c/0x970 fs/hfsplus/extents.c:577 stack backtrace: CPU: 1 UID: 0 PID: 6496 Comm: syz-executor Not tainted 6.15.0-rc2-syzkaller-gc72692105976 #0 PREEMPT Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:466 (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:2079 check_noncircular+0x154/0x174 kernel/locking/lockdep.c:2211 check_prev_add kernel/locking/lockdep.c:3166 [inline] check_prevs_add kernel/locking/lockdep.c:3285 [inline] validate_chain kernel/locking/lockdep.c:3909 [inline] __lock_acquire+0x1728/0x3058 kernel/locking/lockdep.c:5235 lock_acquire+0x14c/0x2e0 kernel/locking/lockdep.c:5866 __mutex_lock_common+0x1d0/0x2190 kernel/locking/mutex.c:601 __mutex_lock kernel/locking/mutex.c:746 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:798 hfsplus_block_free+0xb8/0x3f8 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x14c/0x8d8 fs/hfsplus/extents.c:363 hfsplus_file_truncate+0x5e0/0x970 fs/hfsplus/extents.c:592 hfsplus_delete_inode+0x164/0x210 fs/hfsplus/inode.c:-1 hfsplus_unlink+0x404/0x63c fs/hfsplus/dir.c:405 vfs_unlink+0x2e0/0x520 fs/namei.c:4544 do_unlinkat+0x2b8/0x488 fs/namei.c:4608 __do_sys_unlinkat fs/namei.c:4649 [inline] __se_sys_unlinkat fs/namei.c:4642 [inline] __arm64_sys_unlinkat+0xdc/0xf8 fs/namei.c:4642 __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/0x150 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x78/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 hfsplus: unable to mark blocks free: error -5 hfsplus: can't free extent hfsplus: unable to mark blocks free: error -5 hfsplus: can't free extent hfsplus: unable to mark blocks free: error -5 hfsplus: can't free extent hfsplus: invalid extended attribute record hfsplus: unable to mark blocks free: error -5 hfsplus: can't free extent hfsplus: unable to mark blocks free: error -5 hfsplus: can't free extent