====================================================== WARNING: possible circular locking dependency detected 6.10.0-rc2-syzkaller-g8867bbd4a056 #0 Tainted: G W ------------------------------------------------------ syz-executor.2/6524 is trying to acquire lock: ffff0000c7b420f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_free+0xcc/0x4b8 fs/hfsplus/bitmap.c:182 but task is already holding lock: ffff0000efd28108 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x250/0x9b8 fs/hfsplus/extents.c:576 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+0x3e0/0xc6c fs/buffer.c:2407 hfsplus_read_folio+0x28/0x38 fs/hfsplus/inode.c:28 filemap_read_folio+0x14c/0x39c mm/filemap.c:2355 do_read_cache_folio+0x114/0x548 mm/filemap.c:3788 do_read_cache_page mm/filemap.c:3854 [inline] read_cache_page+0x6c/0x15c mm/filemap.c:3863 read_mapping_page include/linux/pagemap.h:896 [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/0x166c fs/buffer.c:2128 __block_write_begin fs/buffer.c:2177 [inline] block_write_begin fs/buffer.c:2236 [inline] cont_write_begin+0x79c/0xc40 fs/buffer.c:2590 hfsplus_write_begin+0x98/0xe4 fs/hfsplus/inode.c:47 page_symlink+0x234/0x438 fs/namei.c:5236 hfsplus_symlink+0xc0/0x224 fs/hfsplus/dir.c:449 vfs_symlink+0x138/0x28c fs/namei.c:4489 do_symlinkat+0x1bc/0x45c fs/namei.c:4515 __do_sys_symlinkat fs/namei.c:4531 [inline] __se_sys_symlinkat fs/namei.c:4528 [inline] __arm64_sys_symlinkat+0xa4/0xbc fs/namei.c:4528 __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+0x248/0x73c 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_free+0xcc/0x4b8 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x148/0x8d4 fs/hfsplus/extents.c:363 hfsplus_file_truncate+0x698/0x9b8 fs/hfsplus/extents.c:591 hfsplus_setattr+0x184/0x238 fs/hfsplus/inode.c:265 notify_change+0x9d4/0xc84 fs/attr.c:497 do_truncate+0x1c0/0x28c fs/open.c:65 handle_truncate fs/namei.c:3308 [inline] do_open fs/namei.c:3654 [inline] path_openat+0x219c/0x285c fs/namei.c:3807 do_filp_open+0x1bc/0x3cc fs/namei.c:3834 do_sys_openat2+0x124/0x1b8 fs/open.c:1405 do_sys_open fs/open.c:1420 [inline] __do_sys_openat fs/open.c:1436 [inline] __se_sys_openat fs/open.c:1431 [inline] __arm64_sys_openat+0x1f0/0x240 fs/open.c:1431 __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/6524: #0: ffff0000ef354420 (sb_writers#11){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:409 #1: ffff0000efd28300 (&sb->s_type->i_mutex_key#24){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:791 [inline] #1: ffff0000efd28300 (&sb->s_type->i_mutex_key#24){+.+.}-{3:3}, at: do_truncate+0x1ac/0x28c fs/open.c:63 #2: ffff0000efd28108 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x250/0x9b8 fs/hfsplus/extents.c:576 stack backtrace: CPU: 0 PID: 6524 Comm: syz-executor.2 Tainted: G W 6.10.0-rc2-syzkaller-g8867bbd4a056 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:317 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:324 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:114 dump_stack+0x1c/0x28 lib/dump_stack.c:123 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+0x248/0x73c 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_free+0xcc/0x4b8 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x148/0x8d4 fs/hfsplus/extents.c:363 hfsplus_file_truncate+0x698/0x9b8 fs/hfsplus/extents.c:591 hfsplus_setattr+0x184/0x238 fs/hfsplus/inode.c:265 notify_change+0x9d4/0xc84 fs/attr.c:497 do_truncate+0x1c0/0x28c fs/open.c:65 handle_truncate fs/namei.c:3308 [inline] do_open fs/namei.c:3654 [inline] path_openat+0x219c/0x285c fs/namei.c:3807 do_filp_open+0x1bc/0x3cc fs/namei.c:3834 do_sys_openat2+0x124/0x1b8 fs/open.c:1405 do_sys_open fs/open.c:1420 [inline] __do_sys_openat fs/open.c:1436 [inline] __se_sys_openat fs/open.c:1431 [inline] __arm64_sys_openat+0x1f0/0x240 fs/open.c:1431 __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