loop0: detected capacity change from 0 to 1024 ====================================================== WARNING: possible circular locking dependency detected 6.13.0-rc1-syzkaller-00337-g7503345ac5f5 #0 Not tainted ------------------------------------------------------ syz.0.23/6977 is trying to acquire lock: ffff0000c852b0f8 (&sbi->alloc_mutex){+.+.}-{4:4}, at: hfsplus_block_allocate+0x8c/0x728 fs/hfsplus/bitmap.c:35 but task is already holding lock: ffff0000d88387c8 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}, at: hfsplus_file_extend+0x1d0/0x1544 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+0x218/0x28f4 kernel/locking/mutex.c:585 __mutex_lock kernel/locking/mutex.c:735 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:787 hfsplus_get_block+0x2c4/0x1168 fs/hfsplus/extents.c:260 block_read_full_folio+0x39c/0x950 fs/buffer.c:2396 hfsplus_read_folio+0x28/0x38 fs/hfsplus/inode.c:28 filemap_read_folio+0x108/0x318 mm/filemap.c:2366 do_read_cache_folio+0x368/0x5c0 mm/filemap.c:3826 do_read_cache_page mm/filemap.c:3892 [inline] read_cache_page+0x6c/0x15c mm/filemap.c:3901 read_mapping_page include/linux/pagemap.h:1005 [inline] hfsplus_block_allocate+0xe4/0x728 fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0x7b4/0x1544 fs/hfsplus/extents.c:469 hfsplus_get_block+0x398/0x1168 fs/hfsplus/extents.c:245 __block_write_begin_int+0x580/0x166c fs/buffer.c:2116 block_write_begin fs/buffer.c:2226 [inline] cont_write_begin+0x634/0x984 fs/buffer.c:2577 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:46 cont_expand_zero fs/buffer.c:2537 [inline] cont_write_begin+0x6f8/0x984 fs/buffer.c:2567 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:46 generic_cont_expand_simple+0x160/0x258 fs/buffer.c:2468 hfsplus_setattr+0x140/0x24c fs/hfsplus/inode.c:258 notify_change+0x9f0/0xca0 fs/attr.c:552 do_truncate fs/open.c:65 [inline] do_ftruncate+0x3e4/0x4cc fs/open.c:181 do_sys_ftruncate fs/open.c:196 [inline] __do_sys_ftruncate fs/open.c:201 [inline] __se_sys_ftruncate fs/open.c:199 [inline] __arm64_sys_ftruncate+0x94/0xec fs/open.c:199 __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+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/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:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x34f0/0x7904 kernel/locking/lockdep.c:5226 lock_acquire+0x23c/0x724 kernel/locking/lockdep.c:5849 __mutex_lock_common+0x218/0x28f4 kernel/locking/mutex.c:585 __mutex_lock kernel/locking/mutex.c:735 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:787 hfsplus_block_allocate+0x8c/0x728 fs/hfsplus/bitmap.c:35 hfsplus_file_extend+0x7b4/0x1544 fs/hfsplus/extents.c:469 hfsplus_get_block+0x398/0x1168 fs/hfsplus/extents.c:245 __block_write_begin_int+0x580/0x166c fs/buffer.c:2116 block_write_begin fs/buffer.c:2226 [inline] cont_write_begin+0x634/0x984 fs/buffer.c:2577 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:46 cont_expand_zero fs/buffer.c:2504 [inline] cont_write_begin+0x2b0/0x984 fs/buffer.c:2567 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:46 generic_perform_write+0x29c/0x868 mm/filemap.c:4055 __generic_file_write_iter+0xfc/0x204 mm/filemap.c:4156 generic_file_write_iter+0xb8/0x2b4 mm/filemap.c:4182 do_iter_readv_writev+0x490/0x6d4 vfs_writev+0x410/0xbc8 fs/read_write.c:1050 do_pwritev fs/read_write.c:1146 [inline] __do_sys_pwritev2 fs/read_write.c:1204 [inline] __se_sys_pwritev2 fs/read_write.c:1195 [inline] __arm64_sys_pwritev2+0x1d8/0x2ec fs/read_write.c:1195 __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+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/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 *** 3 locks held by syz.0.23/6977: #0: ffff0000d8d5e420 (sb_writers#12){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2964 [inline] #0: ffff0000d8d5e420 (sb_writers#12){.+.+}-{0:0}, at: vfs_writev+0x3a8/0xbc8 fs/read_write.c:1048 #1: ffff0000d88389b8 (&sb->s_type->i_mutex_key#20){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:818 [inline] #1: ffff0000d88389b8 (&sb->s_type->i_mutex_key#20){+.+.}-{4:4}, at: generic_file_write_iter+0x88/0x2b4 mm/filemap.c:4179 #2: ffff0000d88387c8 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{4:4}, at: hfsplus_file_extend+0x1d0/0x1544 fs/hfsplus/extents.c:458 stack backtrace: CPU: 0 UID: 0 PID: 6977 Comm: syz.0.23 Not tainted 6.13.0-rc1-syzkaller-00337-g7503345ac5f5 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:484 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 print_circular_bug+0x154/0x1c0 kernel/locking/lockdep.c:2074 check_noncircular+0x310/0x404 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x34f0/0x7904 kernel/locking/lockdep.c:5226 lock_acquire+0x23c/0x724 kernel/locking/lockdep.c:5849 __mutex_lock_common+0x218/0x28f4 kernel/locking/mutex.c:585 __mutex_lock kernel/locking/mutex.c:735 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:787 hfsplus_block_allocate+0x8c/0x728 fs/hfsplus/bitmap.c:35 hfsplus_file_extend+0x7b4/0x1544 fs/hfsplus/extents.c:469 hfsplus_get_block+0x398/0x1168 fs/hfsplus/extents.c:245 __block_write_begin_int+0x580/0x166c fs/buffer.c:2116 block_write_begin fs/buffer.c:2226 [inline] cont_write_begin+0x634/0x984 fs/buffer.c:2577 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:46 cont_expand_zero fs/buffer.c:2504 [inline] cont_write_begin+0x2b0/0x984 fs/buffer.c:2567 hfsplus_write_begin+0x7c/0xc4 fs/hfsplus/inode.c:46 generic_perform_write+0x29c/0x868 mm/filemap.c:4055 __generic_file_write_iter+0xfc/0x204 mm/filemap.c:4156 generic_file_write_iter+0xb8/0x2b4 mm/filemap.c:4182 do_iter_readv_writev+0x490/0x6d4 vfs_writev+0x410/0xbc8 fs/read_write.c:1050 do_pwritev fs/read_write.c:1146 [inline] __do_sys_pwritev2 fs/read_write.c:1204 [inline] __se_sys_pwritev2 fs/read_write.c:1195 [inline] __arm64_sys_pwritev2+0x1d8/0x2ec fs/read_write.c:1195 __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+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600