======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz-executor/5394 is trying to acquire lock:
ffff8880251ed0f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_free+0xc1/0x4d0 fs/hfsplus/bitmap.c:182
but task is already holding lock:
ffff888078749c08 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x2c6/0xb80 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+0x1e3/0x2400 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
hfsplus_get_block+0x3a1/0x15a0 fs/hfsplus/extents.c:260
block_read_full_page+0x306/0xd40 fs/buffer.c:2290
do_read_cache_page+0x8a1/0x1030 mm/filemap.c:-1
read_mapping_page include/linux/pagemap.h:515 [inline]
hfsplus_block_allocate+0xf1/0x910 fs/hfsplus/bitmap.c:37
hfsplus_file_extend+0xb1f/0x1a50 fs/hfsplus/extents.c:466
hfsplus_get_block+0x430/0x15a0 fs/hfsplus/extents.c:245
__block_write_begin_int+0x565/0x15d0 fs/buffer.c:2012
__block_write_begin fs/buffer.c:2062 [inline]
block_write_begin fs/buffer.c:2122 [inline]
cont_write_begin+0x598/0x7b0 fs/buffer.c:2471
hfsplus_write_begin+0x92/0xe0 fs/hfsplus/inode.c:53
__page_symlink+0x102/0x200 fs/namei.c:5199
hfsplus_symlink+0xc6/0x260 fs/hfsplus/dir.c:449
vfs_symlink+0x247/0x3d0 fs/namei.c:4437
do_symlinkat+0x1ab/0x6b0 fs/namei.c:4466
__do_sys_symlink fs/namei.c:4488 [inline]
__se_sys_symlink fs/namei.c:4486 [inline]
__x64_sys_symlink+0x7a/0x90 fs/namei.c:4486
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
-> #0 (&sbi->alloc_mutex){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c42/0x7d10 kernel/locking/lockdep.c:5012
lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623
__mutex_lock_common+0x1e3/0x2400 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
hfsplus_block_free+0xc1/0x4d0 fs/hfsplus/bitmap.c:182
hfsplus_free_extents+0x10d/0xa50 fs/hfsplus/extents.c:360
hfsplus_file_truncate+0x783/0xb80 fs/hfsplus/extents.c:589
hfsplus_delete_inode+0x17c/0x230 fs/hfsplus/inode.c:-1
hfsplus_unlink+0x4f7/0x7b0 fs/hfsplus/dir.c:405
vfs_unlink+0x385/0x600 fs/namei.c:4288
do_unlinkat+0x391/0x710 fs/namei.c:4356
__do_sys_unlink fs/namei.c:4404 [inline]
__se_sys_unlink fs/namei.c:4402 [inline]
__x64_sys_unlink+0x45/0x50 fs/namei.c:4402
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
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/5394:
#0: ffff88807a838460 (sb_writers#18){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:386
#1: ffff88807874ab80 (&type->i_mutex_dir_key#10/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:822 [inline]
#1: ffff88807874ab80 (&type->i_mutex_dir_key#10/1){+.+.}-{3:3}, at: do_unlinkat+0x1c8/0x710 fs/namei.c:4339
#2: ffff888078749e00 (&sb->s_type->i_mutex_key#26){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
#2: ffff888078749e00 (&sb->s_type->i_mutex_key#26){+.+.}-{3:3}, at: vfs_unlink+0xee/0x600 fs/namei.c:4277
#3: ffff8880251ed198 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_unlink+0x175/0x7b0 fs/hfsplus/dir.c:370
#4: ffff888078749c08 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x2c6/0xb80 fs/hfsplus/extents.c:574
stack backtrace:
CPU: 0 PID: 5394 Comm: syz-executor Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
Call Trace:
<TASK>
dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106
check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2133
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c42/0x7d10 kernel/locking/lockdep.c:5012
lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623
__mutex_lock_common+0x1e3/0x2400 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
hfsplus_block_free+0xc1/0x4d0 fs/hfsplus/bitmap.c:182
hfsplus_free_extents+0x10d/0xa50 fs/hfsplus/extents.c:360
hfsplus_file_truncate+0x783/0xb80 fs/hfsplus/extents.c:589
hfsplus_delete_inode+0x17c/0x230 fs/hfsplus/inode.c:-1
hfsplus_unlink+0x4f7/0x7b0 fs/hfsplus/dir.c:405
vfs_unlink+0x385/0x600 fs/namei.c:4288
do_unlinkat+0x391/0x710 fs/namei.c:4356
__do_sys_unlink fs/namei.c:4404 [inline]
__se_sys_unlink fs/namei.c:4402 [inline]
__x64_sys_unlink+0x45/0x50 fs/namei.c:4402
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f4c80e5fec7
Code: 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 57 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 e8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffc5d4edc98 EFLAGS: 00000206 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f4c80e5fec7
RDX: 00007ffc5d4edcc0 RSI: 00007ffc5d4edd50 RDI: 00007ffc5d4edd50
RBP: 00007ffc5d4edd50 R08: 00007ffc5d4eed50 R09: 00000000ffffffff
R10: 0000000000000100 R11: 0000000000000206 R12: 00007ffc5d4eee40
R13: 00007f4c80ef6120 R14: 0000000000028874 R15: 00007ffc5d4eff10
</TASK>
hfsplus: invalid file type 0174377 for inode 21
hfsplus: invalid file type 0174377 for inode 21