====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc4-syzkaller #0 Not tainted ------------------------------------------------------ syz.0.31/5766 is trying to acquire lock: ffff8881416f80a8 (&q->q_usage_counter(io)#3){++++}-{0:0}, at: __submit_bio+0xba/0x190 block/blk-core.c:629 but task is already holding lock: ffff88810cefd0e8 (&sbi->s_lock){+.+.}-{4:4}, at: exfat_create+0xed/0x220 fs/exfat/namei.c:553 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&sbi->s_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x99/0x9a0 kernel/locking/mutex.c:752 exfat_lookup+0xc9/0x540 fs/exfat/namei.c:701 lookup_open fs/namei.c:3573 [inline] open_last_lookups fs/namei.c:3694 [inline] path_openat+0x5cd/0xdf0 fs/namei.c:3930 do_filp_open+0xad/0x150 fs/namei.c:3960 do_sys_openat2+0x7e/0xe0 fs/open.c:1415 do_sys_open fs/open.c:1430 [inline] __do_sys_openat fs/open.c:1446 [inline] __se_sys_openat fs/open.c:1441 [inline] __x64_sys_openat+0x7c/0xa0 fs/open.c:1441 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xa0/0x180 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&sb->s_type->i_mutex_key#20){++++}-{4:4}: down_write+0x29/0xb0 kernel/locking/rwsem.c:1577 inode_lock include/linux/fs.h:815 [inline] __generic_file_fsync+0x31/0x90 fs/libfs.c:1532 exfat_file_fsync+0x26/0x60 fs/exfat/file.c:524 __loop_update_dio+0x7a/0xf0 drivers/block/loop.c:204 loop_set_status+0x19f/0x270 drivers/block/loop.c:1290 lo_ioctl+0x636/0x930 blkdev_ioctl+0x2ba/0x310 block/ioctl.c:693 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl+0x6b/0xb0 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xa0/0x180 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&q->q_usage_counter(io)#3){++++}-{0:0}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x1236/0x2570 kernel/locking/lockdep.c:5202 lock_acquire+0xeb/0x270 kernel/locking/lockdep.c:5825 bio_queue_enter block/blk.h:75 [inline] blk_mq_submit_bio+0x217/0x7f0 block/blk-mq.c:3069 __submit_bio+0xba/0x190 block/blk-core.c:629 __submit_bio_noacct_mq block/blk-core.c:710 [inline] submit_bio_noacct_nocheck+0x141/0x3d0 block/blk-core.c:739 submit_bh fs/buffer.c:2824 [inline] __sync_dirty_buffer+0x9a/0xe0 fs/buffer.c:2862 exfat_set_vol_flags fs/exfat/super.c:115 [inline] exfat_set_volume_dirty+0x59/0x70 fs/exfat/super.c:124 exfat_create+0xf5/0x220 fs/exfat/namei.c:554 lookup_open fs/namei.c:3595 [inline] open_last_lookups fs/namei.c:3694 [inline] path_openat+0x643/0xdf0 fs/namei.c:3930 do_filp_open+0xad/0x150 fs/namei.c:3960 do_sys_openat2+0x7e/0xe0 fs/open.c:1415 do_sys_open fs/open.c:1430 [inline] __do_sys_openat fs/open.c:1446 [inline] __se_sys_openat fs/open.c:1441 [inline] __x64_sys_openat+0x7c/0xa0 fs/open.c:1441 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xa0/0x180 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: &q->q_usage_counter(io)#3 --> &sb->s_type->i_mutex_key#20 --> &sbi->s_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sbi->s_lock); lock(&sb->s_type->i_mutex_key#20); lock(&sbi->s_lock); rlock(&q->q_usage_counter(io)#3); *** DEADLOCK *** 3 locks held by syz.0.31/5766: #0: ffff888109b68420 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x12/0x40 fs/namespace.c:515 #1: ffff8881101dac68 (&sb->s_type->i_mutex_key#20){++++}-{4:4}, at: inode_lock include/linux/fs.h:815 [inline] #1: ffff8881101dac68 (&sb->s_type->i_mutex_key#20){++++}-{4:4}, at: open_last_lookups fs/namei.c:3691 [inline] #1: ffff8881101dac68 (&sb->s_type->i_mutex_key#20){++++}-{4:4}, at: path_openat+0x235/0xdf0 fs/namei.c:3930 #2: ffff88810cefd0e8 (&sbi->s_lock){+.+.}-{4:4}, at: exfat_create+0xed/0x220 fs/exfat/namei.c:553 stack backtrace: CPU: 0 UID: 0 PID: 5766 Comm: syz.0.31 Not tainted 6.12.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xa3/0x100 lib/dump_stack.c:120 print_circular_bug+0x28d/0x2a0 kernel/locking/lockdep.c:2074 check_noncircular+0x119/0x140 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x1236/0x2570 kernel/locking/lockdep.c:5202 lock_acquire+0xeb/0x270 kernel/locking/lockdep.c:5825 bio_queue_enter block/blk.h:75 [inline] blk_mq_submit_bio+0x217/0x7f0 block/blk-mq.c:3069 __submit_bio+0xba/0x190 block/blk-core.c:629 __submit_bio_noacct_mq block/blk-core.c:710 [inline] submit_bio_noacct_nocheck+0x141/0x3d0 block/blk-core.c:739 submit_bh fs/buffer.c:2824 [inline] __sync_dirty_buffer+0x9a/0xe0 fs/buffer.c:2862 exfat_set_vol_flags fs/exfat/super.c:115 [inline] exfat_set_volume_dirty+0x59/0x70 fs/exfat/super.c:124 exfat_create+0xf5/0x220 fs/exfat/namei.c:554 lookup_open fs/namei.c:3595 [inline] open_last_lookups fs/namei.c:3694 [inline] path_openat+0x643/0xdf0 fs/namei.c:3930 do_filp_open+0xad/0x150 fs/namei.c:3960 do_sys_openat2+0x7e/0xe0 fs/open.c:1415 do_sys_open fs/open.c:1430 [inline] __do_sys_openat fs/open.c:1446 [inline] __se_sys_openat fs/open.c:1441 [inline] __x64_sys_openat+0x7c/0xa0 fs/open.c:1441 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xa0/0x180 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f4ae917e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f4ae9f1b038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f4ae9335f80 RCX: 00007f4ae917e719 RDX: 000000000000275a RSI: 0000000020000080 RDI: ffffffffffffff9c RBP: 00007f4ae91f132e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f4ae9335f80 R15: 00007ffd5cb927f8