loop5: detected capacity change from 0 to 1024
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.5.512/6083 is trying to acquire lock:
ffff0000dc46d0f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_free+0xb8/0x47c fs/hfsplus/bitmap.c:182
but task is already holding lock:
ffff0000dd082988 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x224/0x9ac fs/hfsplus/extents.c:574
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/0x1f60 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
hfsplus_get_block+0x2c0/0x11a0 fs/hfsplus/extents.c:260
block_read_full_folio+0x2f4/0x980 fs/buffer.c:2271
hfsplus_read_folio+0x28/0x38 fs/hfsplus/inode.c:28
filemap_read_folio+0x134/0x384 mm/filemap.c:2490
do_read_cache_folio+0x24c/0x538 mm/filemap.c:3659
do_read_cache_page mm/filemap.c:3701 [inline]
read_cache_page+0x6c/0x184 mm/filemap.c:3710
read_mapping_page include/linux/pagemap.h:793 [inline]
hfsplus_block_allocate+0xd8/0x7e4 fs/hfsplus/bitmap.c:37
hfsplus_file_extend+0x7a0/0x13b4 fs/hfsplus/extents.c:466
hfsplus_get_block+0x324/0x11a0 fs/hfsplus/extents.c:245
__block_write_begin_int+0x350/0x1388 fs/buffer.c:1991
__block_write_begin fs/buffer.c:2041 [inline]
block_write_begin fs/buffer.c:2102 [inline]
cont_write_begin+0x53c/0x780 fs/buffer.c:2456
hfsplus_write_begin+0x98/0xe4 fs/hfsplus/inode.c:52
generic_perform_write+0x234/0x4f4 mm/filemap.c:3862
__generic_file_write_iter+0x130/0x250 mm/filemap.c:3960
generic_file_write_iter+0xb4/0x2b0 mm/filemap.c:3989
call_write_iter include/linux/fs.h:2265 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x3ec/0x7f0 fs/read_write.c:584
ksys_write+0x12c/0x224 fs/read_write.c:637
__do_sys_write fs/read_write.c:649 [inline]
__se_sys_write fs/read_write.c:646 [inline]
__arm64_sys_write+0x7c/0x90 fs/read_write.c:646
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b4 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x58/0x130 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
-> #0 (&sbi->alloc_mutex){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x2880/0x6800 kernel/locking/lockdep.c:5049
lock_acquire+0x20c/0x63c kernel/locking/lockdep.c:5662
__mutex_lock_common+0x190/0x1f60 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
hfsplus_block_free+0xb8/0x47c fs/hfsplus/bitmap.c:182
hfsplus_free_extents+0x10c/0x880 fs/hfsplus/extents.c:360
hfsplus_file_truncate+0x610/0x9ac fs/hfsplus/extents.c:589
hfsplus_delete_inode+0x160/0x20c fs/hfsplus/inode.c:-1
hfsplus_unlink+0x418/0x68c fs/hfsplus/dir.c:405
vfs_unlink+0x2e0/0x4f4 fs/namei.c:4330
do_unlinkat+0x328/0x500 fs/namei.c:4398
__do_sys_unlinkat fs/namei.c:4441 [inline]
__se_sys_unlinkat fs/namei.c:4434 [inline]
__arm64_sys_unlinkat+0xe0/0xfc fs/namei.c:4434
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b4 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x58/0x130 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
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.5.512/6083:
#0: ffff0000f718a460 (sb_writers#28){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:402
#1: ffff0000dd081740 (&type->i_mutex_dir_key#18/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:793 [inline]
#1: ffff0000dd081740 (&type->i_mutex_dir_key#18/1){+.+.}-{3:3}, at: do_unlinkat+0x198/0x500 fs/namei.c:4381
#2: ffff0000dd082b80 (&sb->s_type->i_mutex_key#36){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
#2: ffff0000dd082b80 (&sb->s_type->i_mutex_key#36){+.+.}-{3:3}, at: vfs_unlink+0xd0/0x4f4 fs/namei.c:4319
#3: ffff0000dc46d198 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_unlink+0x14c/0x68c fs/hfsplus/dir.c:370
#4: ffff0000dd082988 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x224/0x9ac fs/hfsplus/extents.c:574
stack backtrace:
CPU: 0 PID: 6083 Comm: syz.5.512 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/18/2026
Call trace:
dump_backtrace+0x1c0/0x1ec arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack+0x30/0x40 lib/dump_stack.c:88
dump_stack_lvl+0xf4/0x15c lib/dump_stack.c:106
dump_stack+0x1c/0x5c lib/dump_stack.c:113
print_circular_bug+0x148/0x1b0 kernel/locking/lockdep.c:2048
check_noncircular+0x264/0x2f8 kernel/locking/lockdep.c:2170
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x2880/0x6800 kernel/locking/lockdep.c:5049
lock_acquire+0x20c/0x63c kernel/locking/lockdep.c:5662
__mutex_lock_common+0x190/0x1f60 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
hfsplus_block_free+0xb8/0x47c fs/hfsplus/bitmap.c:182
hfsplus_free_extents+0x10c/0x880 fs/hfsplus/extents.c:360
hfsplus_file_truncate+0x610/0x9ac fs/hfsplus/extents.c:589
hfsplus_delete_inode+0x160/0x20c fs/hfsplus/inode.c:-1
hfsplus_unlink+0x418/0x68c fs/hfsplus/dir.c:405
vfs_unlink+0x2e0/0x4f4 fs/namei.c:4330
do_unlinkat+0x328/0x500 fs/namei.c:4398
__do_sys_unlinkat fs/namei.c:4441 [inline]
__se_sys_unlinkat fs/namei.c:4434 [inline]
__arm64_sys_unlinkat+0xe0/0xfc fs/namei.c:4434
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b4 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x58/0x130 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585