====================================================== WARNING: possible circular locking dependency detected 4.14.302-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/10265 is trying to acquire lock: (&sbi->alloc_mutex){+.+.}, at: [] hfsplus_block_free+0xc7/0x560 fs/hfsplus/bitmap.c:182 but task is already holding lock: (&tree->tree_lock/1){+.+.}, at: [] hfsplus_find_init+0x161/0x220 fs/hfsplus/bfind.c:33 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&tree->tree_lock/1){+.+.}: __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 hfsplus_find_init+0x161/0x220 fs/hfsplus/bfind.c:33 hfsplus_ext_read_extent+0x15f/0x9e0 fs/hfsplus/extents.c:216 hfsplus_get_block+0x23e/0x820 fs/hfsplus/extents.c:268 block_read_full_page+0x25e/0x8d0 fs/buffer.c:2316 do_read_cache_page+0x38e/0xc10 mm/filemap.c:2713 read_mapping_page include/linux/pagemap.h:398 [inline] hfsplus_block_allocate+0x189/0x910 fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0x421/0xef0 fs/hfsplus/extents.c:463 hfsplus_get_block+0x15b/0x820 fs/hfsplus/extents.c:245 __block_write_begin_int+0x35c/0x11d0 fs/buffer.c:2038 __block_write_begin fs/buffer.c:2088 [inline] block_write_begin+0x58/0x270 fs/buffer.c:2147 cont_write_begin+0x4a3/0x740 fs/buffer.c:2497 hfsplus_write_begin+0x87/0x130 fs/hfsplus/inode.c:53 cont_expand_zero fs/buffer.c:2424 [inline] cont_write_begin+0x296/0x740 fs/buffer.c:2487 hfsplus_write_begin+0x87/0x130 fs/hfsplus/inode.c:53 generic_perform_write+0x1d5/0x430 mm/filemap.c:3055 __generic_file_write_iter+0x227/0x590 mm/filemap.c:3180 generic_file_write_iter+0x36f/0x650 mm/filemap.c:3208 call_write_iter include/linux/fs.h:1780 [inline] aio_write+0x2ed/0x560 fs/aio.c:1553 io_submit_one fs/aio.c:1641 [inline] do_io_submit+0x847/0x1570 fs/aio.c:1709 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}: __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 hfsplus_get_block+0x1f9/0x820 fs/hfsplus/extents.c:260 block_read_full_page+0x25e/0x8d0 fs/buffer.c:2316 do_read_cache_page+0x38e/0xc10 mm/filemap.c:2713 read_mapping_page include/linux/pagemap.h:398 [inline] hfsplus_block_allocate+0x189/0x910 fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0x421/0xef0 fs/hfsplus/extents.c:463 hfsplus_get_block+0x15b/0x820 fs/hfsplus/extents.c:245 __block_write_begin_int+0x35c/0x11d0 fs/buffer.c:2038 __block_write_begin fs/buffer.c:2088 [inline] block_write_begin+0x58/0x270 fs/buffer.c:2147 cont_write_begin+0x4a3/0x740 fs/buffer.c:2497 hfsplus_write_begin+0x87/0x130 fs/hfsplus/inode.c:53 cont_expand_zero fs/buffer.c:2424 [inline] cont_write_begin+0x296/0x740 fs/buffer.c:2487 hfsplus_write_begin+0x87/0x130 fs/hfsplus/inode.c:53 generic_perform_write+0x1d5/0x430 mm/filemap.c:3055 __generic_file_write_iter+0x227/0x590 mm/filemap.c:3180 generic_file_write_iter+0x36f/0x650 mm/filemap.c:3208 call_write_iter include/linux/fs.h:1780 [inline] aio_write+0x2ed/0x560 fs/aio.c:1553 io_submit_one fs/aio.c:1641 [inline] do_io_submit+0x847/0x1570 fs/aio.c:1709 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 -> #0 (&sbi->alloc_mutex){+.+.}: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 hfsplus_block_free+0xc7/0x560 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x320/0x440 fs/hfsplus/extents.c:371 hfsplus_file_truncate+0xbc0/0xe80 fs/hfsplus/extents.c:585 hfsplus_file_release+0xbc/0x1e0 fs/hfsplus/inode.c:234 __fput+0x25f/0x7a0 fs/file_table.c:210 task_work_run+0x11f/0x190 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0xa44/0x2850 kernel/exit.c:868 do_group_exit+0x100/0x2e0 kernel/exit.c:965 get_signal+0x38d/0x1ca0 kernel/signal.c:2412 do_signal+0x7c/0x1550 arch/x86/kernel/signal.c:792 exit_to_usermode_loop+0x160/0x200 arch/x86/entry/common.c:160 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 other info that might help us debug this: Chain exists of: &sbi->alloc_mutex --> &HFSPLUS_I(inode)->extents_lock --> &tree->tree_lock/1 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock/1); lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock/1); lock(&sbi->alloc_mutex); *** DEADLOCK *** 3 locks held by syz-executor.0/10265: #0: (&sb->s_type->i_mutex_key#21){+.+.}, at: [] inode_lock include/linux/fs.h:719 [inline] #0: (&sb->s_type->i_mutex_key#21){+.+.}, at: [] hfsplus_file_release+0xb4/0x1e0 fs/hfsplus/inode.c:233 #1: (&hip->extents_lock){+.+.}, at: [] hfsplus_file_truncate+0x1ba/0xe80 fs/hfsplus/extents.c:571 #2: (&tree->tree_lock/1){+.+.}, at: [] hfsplus_find_init+0x161/0x220 fs/hfsplus/bfind.c:33 stack backtrace: CPU: 1 PID: 10265 Comm: syz-executor.0 Not tainted 4.14.302-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x281 lib/dump_stack.c:58 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258 check_prev_add kernel/locking/lockdep.c:1905 [inline] check_prevs_add kernel/locking/lockdep.c:2022 [inline] validate_chain kernel/locking/lockdep.c:2464 [inline] __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 hfsplus_block_free+0xc7/0x560 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x320/0x440 fs/hfsplus/extents.c:371 hfsplus_file_truncate+0xbc0/0xe80 fs/hfsplus/extents.c:585 hfsplus_file_release+0xbc/0x1e0 fs/hfsplus/inode.c:234 __fput+0x25f/0x7a0 fs/file_table.c:210 task_work_run+0x11f/0x190 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0xa44/0x2850 kernel/exit.c:868 do_group_exit+0x100/0x2e0 kernel/exit.c:965 get_signal+0x38d/0x1ca0 kernel/signal.c:2412 do_signal+0x7c/0x1550 arch/x86/kernel/signal.c:792 exit_to_usermode_loop+0x160/0x200 arch/x86/entry/common.c:160 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 RIP: 0033:0x7f7d4c8cd0c9 RSP: 002b:00007f7d4ae3f218 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: fffffffffffffe00 RBX: 00007f7d4c9ecf88 RCX: 00007f7d4c8cd0c9 RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007f7d4c9ecf88 RBP: 00007f7d4c9ecf80 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f7d4c9ecf8c R13: 00007fff0a4f557f R14: 00007f7d4ae3f300 R15: 0000000000022000 EXT4-fs error (device loop2): ext4_orphan_get:1265: comm syz-executor.2: bad orphan inode 34020 EXT4-fs (loop2): mounted filesystem without journal. Opts: ,errors=continue ADFS-fs: unrecognised mount option "#" or missing value ADFS-fs: unrecognised mount option "#" or missing value audit: type=1800 audit(1673339853.714:4): pid=10432 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.5" name="file0" dev="sda1" ino=14041 res=0 FAT-fs (loop1): Directory bread(block 64) failed FAT-fs (loop1): Directory bread(block 65) failed ADFS-fs: unrecognised mount option "#" or missing value FAT-fs (loop1): Directory bread(block 66) failed FAT-fs (loop1): Directory bread(block 67) failed FAT-fs (loop1): Directory bread(block 68) failed FAT-fs (loop1): Directory bread(block 69) failed FAT-fs (loop1): Directory bread(block 70) failed FAT-fs (loop1): Directory bread(block 71) failed FAT-fs (loop1): Directory bread(block 72) failed FAT-fs (loop1): Directory bread(block 73) failed audit: type=1800 audit(1673339854.114:5): pid=10422 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.1" name="file2" dev="loop1" ino=3 res=0 attempt to access beyond end of device loop1: rw=0, want=1832, limit=256 FAT-fs (loop1): Filesystem has been set read-only audit: type=1800 audit(1673339854.114:6): pid=10422 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.1" name="file2" dev="loop1" ino=3 res=0 attempt to access beyond end of device loop1: rw=0, want=9832, limit=256 attempt to access beyond end of device loop1: rw=0, want=1808, limit=256 ADFS-fs: unrecognised mount option "#" or missing value audit: type=1800 audit(1673339854.574:7): pid=10481 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.5" name="file0" dev="sda1" ino=13989 res=0 FAT-fs (loop1): Directory bread(block 64) failed FAT-fs (loop1): Directory bread(block 65) failed FAT-fs (loop1): Directory bread(block 66) failed FAT-fs (loop1): Directory bread(block 67) failed FAT-fs (loop1): Directory bread(block 68) failed audit: type=1800 audit(1673339855.224:8): pid=10489 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.0" name="file0" dev="sda1" ino=14055 res=0 audit: type=1800 audit(1673339855.224:9): pid=10492 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.3" name="file0" dev="sda1" ino=14056 res=0 FAT-fs (loop1): Directory bread(block 69) failed FAT-fs (loop1): Directory bread(block 70) failed FAT-fs (loop1): Directory bread(block 71) failed FAT-fs (loop1): Directory bread(block 72) failed FAT-fs (loop1): Directory bread(block 73) failed audit: type=1800 audit(1673339855.794:10): pid=10467 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.1" name="file2" dev="loop1" ino=4 res=0 attempt to access beyond end of device audit: type=1800 audit(1673339855.824:11): pid=10467 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.1" name="file2" dev="loop1" ino=4 res=0 audit: type=1800 audit(1673339856.604:12): pid=10508 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.5" name="file0" dev="sda1" ino=14057 res=0 audit: type=1800 audit(1673339856.604:13): pid=10506 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.0" name="file0" dev="sda1" ino=14058 res=0 loop1: rw=0, want=1832, limit=256 FAT-fs (loop1): Filesystem has been set read-only attempt to access beyond end of device loop1: rw=0, want=9832, limit=256 attempt to access beyond end of device loop1: rw=0, want=1808, limit=256 SQUASHFS error: Unknown inode type 0 in squashfs_iget! FAT-fs (loop1): Directory bread(block 64) failed FAT-fs (loop1): Directory bread(block 65) failed FAT-fs (loop1): Directory bread(block 66) failed FAT-fs (loop1): Directory bread(block 67) failed FAT-fs (loop1): Directory bread(block 68) failed FAT-fs (loop1): Directory bread(block 69) failed FAT-fs (loop1): Directory bread(block 70) failed FAT-fs (loop1): Directory bread(block 71) failed FAT-fs (loop1): Directory bread(block 72) failed FAT-fs (loop1): Directory bread(block 73) failed kauditd_printk_skb: 4 callbacks suppressed audit: type=1800 audit(1673339858.794:18): pid=10559 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.1" name="file2" dev="loop1" ino=5 res=0 attempt to access beyond end of device audit: type=1800 audit(1673339858.824:19): pid=10559 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.1" name="file2" dev="loop1" ino=5 res=0 loop1: rw=0, want=1832, limit=256 FAT-fs (loop1): Filesystem has been set read-only attempt to access beyond end of device loop1: rw=0, want=9832, limit=256 attempt to access beyond end of device loop1: rw=0, want=1808, limit=256 FAT-fs (loop1): Directory bread(block 64) failed FAT-fs (loop1): Directory bread(block 65) failed FAT-fs (loop1): Directory bread(block 66) failed FAT-fs (loop1): Directory bread(block 67) failed FAT-fs (loop1): Directory bread(block 68) failed FAT-fs (loop1): Directory bread(block 69) failed FAT-fs (loop1): Directory bread(block 70) failed FAT-fs (loop1): Directory bread(block 71) failed FAT-fs (loop1): Directory bread(block 72) failed FAT-fs (loop1): Directory bread(block 73) failed audit: type=1800 audit(1673339859.494:20): pid=10616 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.1" name="file2" dev="loop1" ino=6 res=0 attempt to access beyond end of device audit: type=1800 audit(1673339859.514:21): pid=10616 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.1" name="file2" dev="loop1" ino=6 res=0 loop1: rw=0, want=1832, limit=256 FAT-fs (loop1): Filesystem has been set read-only attempt to access beyond end of device loop1: rw=0, want=9832, limit=256 attempt to access beyond end of device loop1: rw=0, want=1808, limit=256