loop0: detected capacity change from 0 to 1024 ====================================================== WARNING: possible circular locking dependency detected 6.2.0-rc5-next-20230123-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor188/5088 is trying to acquire lock: ffff88807ce340b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0xe87/0x10d0 fs/hfsplus/extents.c:595 but task is already holding lock: ffff88807c833708 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x205/0x10d0 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 kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 hfsplus_get_block+0x27b/0x9b0 fs/hfsplus/extents.c:260 block_read_full_folio+0x41d/0xab0 fs/buffer.c:2318 filemap_read_folio+0xdb/0x2c0 mm/filemap.c:2422 do_read_cache_folio+0x1df/0x510 mm/filemap.c:3551 do_read_cache_page mm/filemap.c:3593 [inline] read_cache_page+0x5d/0x160 mm/filemap.c:3602 read_mapping_page include/linux/pagemap.h:767 [inline] __hfs_bnode_create+0x61b/0x820 fs/hfsplus/bnode.c:440 hfsplus_bnode_find+0x408/0xc50 fs/hfsplus/bnode.c:486 hfsplus_brec_find+0x2b3/0x510 fs/hfsplus/bfind.c:183 hfsplus_brec_read+0x2c/0x120 fs/hfsplus/bfind.c:222 hfsplus_find_cat+0x1d4/0x490 fs/hfsplus/catalog.c:202 hfsplus_iget+0x480/0x7c0 fs/hfsplus/super.c:82 hfsplus_fill_super+0xd15/0x1a30 fs/hfsplus/super.c:503 mount_bdev+0x351/0x410 fs/super.c:1359 legacy_get_tree+0x109/0x220 fs/fs_context.c:610 vfs_get_tree+0x8d/0x2f0 fs/super.c:1489 do_new_mount fs/namespace.c:3031 [inline] path_mount+0x132a/0x1e20 fs/namespace.c:3361 do_mount fs/namespace.c:3374 [inline] __do_sys_mount fs/namespace.c:3583 [inline] __se_sys_mount fs/namespace.c:3560 [inline] __x64_sys_mount+0x283/0x300 fs/namespace.c:3560 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&tree->tree_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3107 [inline] check_prevs_add kernel/locking/lockdep.c:3226 [inline] validate_chain kernel/locking/lockdep.c:3841 [inline] __lock_acquire+0x2a9d/0x5780 kernel/locking/lockdep.c:5073 lock_acquire.part.0+0x11c/0x350 kernel/locking/lockdep.c:5690 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 hfsplus_file_truncate+0xe87/0x10d0 fs/hfsplus/extents.c:595 hfsplus_delete_inode+0x191/0x220 fs/hfsplus/inode.c:454 hfsplus_unlink+0x5a6/0x830 fs/hfsplus/dir.c:405 hfsplus_rename+0xc2/0x210 fs/hfsplus/dir.c:547 vfs_rename+0xef6/0x17a0 fs/namei.c:4772 do_renameat2+0xb62/0xc90 fs/namei.c:4923 __do_sys_rename fs/namei.c:4969 [inline] __se_sys_rename fs/namei.c:4967 [inline] __x64_sys_rename+0x81/0xa0 fs/namei.c:4967 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock); lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock); *** DEADLOCK *** 6 locks held by syz-executor188/5088: #0: ffff88801c858460 (sb_writers#10){.+.+}-{0:0}, at: do_renameat2+0x37f/0xc90 fs/namei.c:4859 #1: ffff88807c832b80 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:793 [inline] #1: ffff88807c832b80 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: lock_rename+0x229/0x280 fs/namei.c:2991 #2: ffff88807c833240 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline] #2: ffff88807c833240 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: lock_two_nondirectories+0xf0/0x110 fs/inode.c:1122 #3: ffff88807c833900 (&sb->s_type->i_mutex_key#15/4){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:793 [inline] #3: ffff88807c833900 (&sb->s_type->i_mutex_key#15/4){+.+.}-{3:3}, at: lock_two_nondirectories+0xd5/0x110 fs/inode.c:1124 #4: ffff88807c150998 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_unlink+0x151/0x830 fs/hfsplus/dir.c:370 #5: ffff88807c833708 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_truncate+0x205/0x10d0 fs/hfsplus/extents.c:576 stack backtrace: CPU: 1 PID: 5088 Comm: syz-executor188 Not tainted 6.2.0-rc5-next-20230123-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3107 [inline] check_prevs_add kernel/locking/lockdep.c:3226 [inline] validate_chain kernel/locking/lockdep.c:3841 [inline] __lock_acquire+0x2a9d/0x5780 kernel/locking/lockdep.c:5073 lock_acquire.part.0+0x11c/0x350 kernel/locking/lockdep.c:5690 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747 hfsplus_file_truncate+0xe87/0x10d0 fs/hfsplus/extents.c:595 hfsplus_delete_inode+0x191/0x220 fs/hfsplus/inode.c:454 hfsplus_unlink+0x5a6/0x830 fs/hfsplus/dir.c:405 hfsplus_rename+0xc2/0x210 fs/hfsplus/dir.c:547 vfs_rename+0xef6/0x17a0 fs/namei.c:4772 do_renameat2+0xb62/0xc90 fs/namei.c:4923 __do_sys_rename fs/namei.c:4969 [inline] __se_sys_rename fs/namei.c:4967 [inline] __x64_sys_rename+0x81/0xa0 fs/namei.c:4967 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fbbe5d140b9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 31 18 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fbbe5c972f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000052 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fbbe5d140b9 RDX: 0000000000000031 RSI: 00000000200001c0 RDI: 0000000020000180 RBP: 00007fbbe5d92778 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000000005fb R11: 0000000000000246 R12: 00007fbbe5d92770 R13: 736f706d6f636564 R14: 0030656c69662f2e R15: 0073756c70736668