possible deadlock in hfsplus_find_init

Status: upstream: reported C repro on 2026/08/21 23:10
Reported-by: syzbot+6184b46a0dfce39dad9b@syzkaller.appspotmail.com
First crash: 7d17h, last: 6d21h
Bug presence (1)
Date Name Commit Repro Result
2026/08/28 upstream (ToT) c20313e98b04 C Failed due to an error; will retry later
Similar bugs (5)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in hfsplus_find_init hfsplus 4 syz, C 4 1272d 1340d 0/1 upstream: reported C repro on 2022/12/27 19:37
linux-4.19 possible deadlock in hfsplus_find_init hfsplus 4 syz, C error 9 1326d 1365d 0/1 upstream: reported C repro on 2022/12/03 13:19
linux-6.1 possible deadlock in hfsplus_find_init origin:upstream missing-backport 4 syz, C inconclusive 100 1d22h 1263d 0/3 upstream: reported C repro on 2023/03/15 11:24
linux-5.15 possible deadlock in hfsplus_find_init origin:upstream 4 syz, C error 71 7d15h 1240d 0/3 upstream: reported C repro on 2023/04/06 17:26
upstream possible deadlock in hfsplus_find_init prio:high hfs 4 syz, C error error 1065 1h13m 1346d 0/29 upstream: reported C repro on 2022/12/22 07:31

Sample crash report:
syz.0.17[5952]: memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set
loop0: detected capacity change from 0 to 1024
syz.0.17: attempt to access beyond end of device
loop0: rw=0, sector=5778, nr_sectors = 2 limit=1024
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.17/5952 is trying to acquire lock:
ffff88802e8980b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfsplus_find_init+0x154/0x1d0 fs/hfsplus/bfind.c:28

but task is already holding lock:
ffff88802eb73048 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x2b7/0xb60 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 kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747
       hfsplus_file_extend+0x213/0x1af0 fs/hfsplus/extents.c:455
       hfsplus_bmap_reserve+0x10b/0x510 fs/hfsplus/btree.c:358
       __hfsplus_ext_write_extent+0x264/0x520 fs/hfsplus/extents.c:104
       __hfsplus_ext_cache_extent+0x81/0xbd0 fs/hfsplus/extents.c:186
       hfsplus_ext_read_extent fs/hfsplus/extents.c:218 [inline]
       hfsplus_file_extend+0x4b9/0x1af0 fs/hfsplus/extents.c:459
       hfsplus_get_block+0x421/0x1520 fs/hfsplus/extents.c:245
       __block_write_begin_int+0x571/0x1b00 fs/buffer.c:2124
       __block_write_begin fs/buffer.c:2173 [inline]
       block_write_begin+0x9a/0x1e0 fs/buffer.c:2234
       cont_write_begin+0x5fd/0x800 fs/buffer.c:2591
       hfsplus_write_begin+0x8b/0xd0 fs/hfsplus/inode.c:52
       generic_perform_write+0x2fe/0x5c0 mm/filemap.c:4036
       generic_file_write_iter+0xaf/0x2e0 mm/filemap.c:4157
       call_write_iter include/linux/fs.h:2018 [inline]
       aio_write+0x564/0x7d0 fs/aio.c:1593
       __io_submit_one fs/aio.c:-1 [inline]
       io_submit_one+0x768/0x12d0 fs/aio.c:2012
       __do_sys_io_submit fs/aio.c:2071 [inline]
       __se_sys_io_submit+0x1a1/0x310 fs/aio.c:2041
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&tree->tree_lock/1){+.+.}-{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+0x37ef/0x7d80 kernel/locking/lockdep.c:5137
       lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747
       hfsplus_find_init+0x154/0x1d0 fs/hfsplus/bfind.c:28
       hfsplus_file_truncate+0x39f/0xb60 fs/hfsplus/extents.c:580
       hfsplus_write_begin+0xcc/0xd0 fs/hfsplus/inode.c:56
       cont_expand_zero fs/buffer.c:2551 [inline]
       cont_write_begin+0x659/0x800 fs/buffer.c:2581
       hfsplus_write_begin+0x8b/0xd0 fs/hfsplus/inode.c:52
       generic_perform_write+0x2fe/0x5c0 mm/filemap.c:4036
       generic_file_write_iter+0xaf/0x2e0 mm/filemap.c:4157
       call_write_iter include/linux/fs.h:2018 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x474/0x9a0 fs/read_write.c:584
       ksys_pwrite64 fs/read_write.c:699 [inline]
       __do_sys_pwrite64 fs/read_write.c:709 [inline]
       __se_sys_pwrite64 fs/read_write.c:706 [inline]
       __x64_sys_pwrite64+0x198/0x220 fs/read_write.c:706
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&HFSPLUS_I(inode)->extents_lock);
                               lock(&tree->tree_lock/1);
                               lock(&HFSPLUS_I(inode)->extents_lock);
  lock(&tree->tree_lock/1);

 *** DEADLOCK ***

3 locks held by syz.0.17/5952:
 #0: ffff888025cd0418 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x21e/0x9a0 fs/read_write.c:580
 #1: ffff88802eb73250 (&sb->s_type->i_mutex_key#20){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
 #1: ffff88802eb73250 (&sb->s_type->i_mutex_key#20){+.+.}-{3:3}, at: generic_file_write_iter+0x83/0x2e0 mm/filemap.c:4154
 #2: ffff88802eb73048 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x2b7/0xb60 fs/hfsplus/extents.c:574

stack backtrace:
CPU: 1 PID: 5952 Comm: syz.0.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x18c/0x250 lib/dump_stack.c:106
 check_noncircular+0x2fc/0x400 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+0x37ef/0x7d80 kernel/locking/lockdep.c:5137
 lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747
 hfsplus_find_init+0x154/0x1d0 fs/hfsplus/bfind.c:28
 hfsplus_file_truncate+0x39f/0xb60 fs/hfsplus/extents.c:580
 hfsplus_write_begin+0xcc/0xd0 fs/hfsplus/inode.c:56
 cont_expand_zero fs/buffer.c:2551 [inline]
 cont_write_begin+0x659/0x800 fs/buffer.c:2581
 hfsplus_write_begin+0x8b/0xd0 fs/hfsplus/inode.c:52
 generic_perform_write+0x2fe/0x5c0 mm/filemap.c:4036
 generic_file_write_iter+0xaf/0x2e0 mm/filemap.c:4157
 call_write_iter include/linux/fs.h:2018 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x474/0x9a0 fs/read_write.c:584
 ksys_pwrite64 fs/read_write.c:699 [inline]
 __do_sys_pwrite64 fs/read_write.c:709 [inline]
 __se_sys_pwrite64 fs/read_write.c:706 [inline]
 __x64_sys_pwrite64+0x198/0x220 fs/read_write.c:706
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f3cb379e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe7d78be98 EFLAGS: 00000246 ORIG_RAX: 0000000000000012
RAX: ffffffffffffffda RBX: 00007f3cb3a25fa0 RCX: 00007f3cb379e0d9
RDX: 000000000000fdef RSI: 0000200000000140 RDI: 0000000000000005
RBP: 00007f3cb3835024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000e7c R11: 0000000000000246 R12: 0000000000000000
R13: 00007f3cb3a25fac R14: 00007f3cb3a25fa0 R15: 00007f3cb3a25fa0
 </TASK>
hfsplus: can't free extent

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/08/22 19:28 linux-6.6.y c610b395b0a5 1e72964b .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-6-kasan possible deadlock in hfsplus_find_init
2026/08/22 14:20 linux-6.6.y c610b395b0a5 1e72964b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfsplus_find_init
2026/08/22 14:16 linux-6.6.y c610b395b0a5 1e72964b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfsplus_find_init
2026/08/21 23:10 linux-6.6.y c610b395b0a5 1e72964b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfsplus_find_init
* Struck through repros no longer work on HEAD.