====================================================== WARNING: possible circular locking dependency detected 6.8.0-rc7-syzkaller-g707081b61156 #0 Not tainted ------------------------------------------------------ syz-executor.2/8892 is trying to acquire lock: ffff0000d3fbc0f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_allocate+0x90/0x824 fs/hfsplus/bitmap.c:35 but task is already holding lock: ffff0000cc841c08 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x1d0/0x1544 fs/hfsplus/extents.c:457 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}: __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:608 __mutex_lock kernel/locking/mutex.c:752 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804 hfsplus_get_block+0x2c4/0x1168 fs/hfsplus/extents.c:260 block_read_full_folio+0x3d4/0xc58 fs/buffer.c:2382 hfsplus_read_folio+0x28/0x38 fs/hfsplus/inode.c:28 filemap_read_folio+0x14c/0x39c mm/filemap.c:2324 do_read_cache_folio+0x114/0x548 mm/filemap.c:3703 do_read_cache_page mm/filemap.c:3769 [inline] read_cache_page+0x6c/0x15c mm/filemap.c:3778 read_mapping_page include/linux/pagemap.h:888 [inline] hfsplus_block_allocate+0xe0/0x824 fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0x7b4/0x1544 fs/hfsplus/extents.c:468 hfsplus_get_block+0x398/0x1168 fs/hfsplus/extents.c:245 __block_write_begin_int+0x580/0x16a0 fs/buffer.c:2103 __block_write_begin fs/buffer.c:2152 [inline] block_write_begin fs/buffer.c:2211 [inline] cont_write_begin+0x79c/0xc40 fs/buffer.c:2565 hfsplus_write_begin+0x98/0xe4 fs/hfsplus/inode.c:47 cont_expand_zero fs/buffer.c:2492 [inline] cont_write_begin+0x2d8/0xc40 fs/buffer.c:2555 hfsplus_write_begin+0x98/0xe4 fs/hfsplus/inode.c:47 generic_cont_expand_simple+0x160/0x258 fs/buffer.c:2456 hfsplus_setattr+0x148/0x244 fs/hfsplus/inode.c:259 notify_change+0x9d4/0xc8c fs/attr.c:499 do_truncate+0x1c0/0x28c fs/open.c:66 do_sys_ftruncate+0x284/0x318 fs/open.c:194 __do_sys_ftruncate fs/open.c:205 [inline] __se_sys_ftruncate fs/open.c:203 [inline] __arm64_sys_ftruncate+0x60/0x74 fs/open.c:203 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 -> #0 (&sbi->alloc_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x3384/0x763c kernel/locking/lockdep.c:5137 lock_acquire+0x23c/0x71c kernel/locking/lockdep.c:5754 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:608 __mutex_lock kernel/locking/mutex.c:752 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804 hfsplus_block_allocate+0x90/0x824 fs/hfsplus/bitmap.c:35 hfsplus_file_extend+0x7b4/0x1544 fs/hfsplus/extents.c:468 hfsplus_get_block+0x398/0x1168 fs/hfsplus/extents.c:245 __block_write_begin_int+0x580/0x16a0 fs/buffer.c:2103 __block_write_begin fs/buffer.c:2152 [inline] block_write_begin fs/buffer.c:2211 [inline] cont_write_begin+0x79c/0xc40 fs/buffer.c:2565 hfsplus_write_begin+0x98/0xe4 fs/hfsplus/inode.c:47 cont_expand_zero fs/buffer.c:2492 [inline] cont_write_begin+0x2d8/0xc40 fs/buffer.c:2555 hfsplus_write_begin+0x98/0xe4 fs/hfsplus/inode.c:47 generic_cont_expand_simple+0x160/0x258 fs/buffer.c:2456 hfsplus_setattr+0x148/0x244 fs/hfsplus/inode.c:259 notify_change+0x9d4/0xc8c fs/attr.c:499 do_truncate+0x1c0/0x28c fs/open.c:66 vfs_truncate+0x2b8/0x360 fs/open.c:112 do_sys_truncate+0xec/0x1b4 fs/open.c:135 __do_sys_truncate fs/open.c:147 [inline] __se_sys_truncate fs/open.c:145 [inline] __arm64_sys_truncate+0x5c/0x70 fs/open.c:145 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 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 *** 3 locks held by syz-executor.2/8892: #0: ffff0000d4962420 (sb_writers#25){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:409 #1: ffff0000cc841e00 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline] #1: ffff0000cc841e00 (&sb->s_type->i_mutex_key#32){+.+.}-{3:3}, at: do_truncate+0x1ac/0x28c fs/open.c:64 #2: ffff0000cc841c08 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x1d0/0x1544 fs/hfsplus/extents.c:457 stack backtrace: CPU: 1 PID: 8892 Comm: syz-executor.2 Not tainted 6.8.0-rc7-syzkaller-g707081b61156 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106 dump_stack+0x1c/0x28 lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2060 check_noncircular+0x310/0x404 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x3384/0x763c kernel/locking/lockdep.c:5137 lock_acquire+0x23c/0x71c kernel/locking/lockdep.c:5754 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:608 __mutex_lock kernel/locking/mutex.c:752 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804 hfsplus_block_allocate+0x90/0x824 fs/hfsplus/bitmap.c:35 hfsplus_file_extend+0x7b4/0x1544 fs/hfsplus/extents.c:468 hfsplus_get_block+0x398/0x1168 fs/hfsplus/extents.c:245 __block_write_begin_int+0x580/0x16a0 fs/buffer.c:2103 __block_write_begin fs/buffer.c:2152 [inline] block_write_begin fs/buffer.c:2211 [inline] cont_write_begin+0x79c/0xc40 fs/buffer.c:2565 hfsplus_write_begin+0x98/0xe4 fs/hfsplus/inode.c:47 cont_expand_zero fs/buffer.c:2492 [inline] cont_write_begin+0x2d8/0xc40 fs/buffer.c:2555 hfsplus_write_begin+0x98/0xe4 fs/hfsplus/inode.c:47 generic_cont_expand_simple+0x160/0x258 fs/buffer.c:2456 hfsplus_setattr+0x148/0x244 fs/hfsplus/inode.c:259 notify_change+0x9d4/0xc8c fs/attr.c:499 do_truncate+0x1c0/0x28c fs/open.c:66 vfs_truncate+0x2b8/0x360 fs/open.c:112 do_sys_truncate+0xec/0x1b4 fs/open.c:135 __do_sys_truncate fs/open.c:147 [inline] __se_sys_truncate fs/open.c:145 [inline] __arm64_sys_truncate+0x5c/0x70 fs/open.c:145 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598