====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ syz.0.157/6767 is trying to acquire lock: ffff88801fcccd40 (&sb->s_type->i_mutex_key#25){++++}-{4:4}, at: inode_lock include/linux/fs.h:1026 [inline] ffff88801fcccd40 (&sb->s_type->i_mutex_key#25){++++}-{4:4}, at: configfs_depend_item_unlocked+0xf3/0x6a0 fs/configfs/dir.c:1268 but task is already holding lock: ffffffff916ba660 (tpg_instances_lock){+.+.}-{4:4}, at: usbg_make_tpg+0x10b/0x610 drivers/usb/gadget/function/f_tcm.c:1669 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (tpg_instances_lock){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821 usbg_make_tpg+0x10b/0x610 drivers/usb/gadget/function/f_tcm.c:1669 target_fabric_make_tpg+0xab/0x8c0 drivers/target/target_core_fabric_configfs.c:947 configfs_mkdir+0x525/0xd40 fs/configfs/dir.c:1369 vfs_mkdir+0x36d/0x8a0 fs/namei.c:5428 filename_mkdirat+0x4c4/0x630 fs/namei.c:5461 __do_sys_mkdirat fs/namei.c:5482 [inline] __se_sys_mkdirat fs/namei.c:5479 [inline] __ia32_sys_mkdirat+0x88/0xc0 fs/namei.c:5479 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x14b/0x8c0 arch/x86/entry/syscall_32.c:282 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:307 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #1 (&subsys->su_mutex){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821 configfs_rmdir+0x5ae/0x950 fs/configfs/dir.c:1565 vfs_rmdir fs/namei.c:5533 [inline] vfs_rmdir+0x328/0x8e0 fs/namei.c:5506 filename_rmdir+0x31a/0x610 fs/namei.c:5590 __do_sys_rmdir fs/namei.c:5613 [inline] __se_sys_rmdir fs/namei.c:5610 [inline] __ia32_sys_rmdir+0x45/0x60 fs/namei.c:5610 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x14b/0x8c0 arch/x86/entry/syscall_32.c:282 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:307 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #0 (&sb->s_type->i_mutex_key#25){++++}-{4:4}: check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 down_write+0x86/0x1f0 kernel/locking/rwsem.c:1631 inode_lock include/linux/fs.h:1026 [inline] configfs_depend_item_unlocked+0xf3/0x6a0 fs/configfs/dir.c:1268 usbg_make_tpg+0x251/0x610 drivers/usb/gadget/function/f_tcm.c:1692 target_fabric_make_tpg+0xab/0x8c0 drivers/target/target_core_fabric_configfs.c:947 configfs_mkdir+0x525/0xd40 fs/configfs/dir.c:1369 vfs_mkdir+0x36d/0x8a0 fs/namei.c:5428 filename_mkdirat+0x4c4/0x630 fs/namei.c:5461 __do_sys_mkdirat fs/namei.c:5482 [inline] __se_sys_mkdirat fs/namei.c:5479 [inline] __ia32_sys_mkdirat+0x88/0xc0 fs/namei.c:5479 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x14b/0x8c0 arch/x86/entry/syscall_32.c:282 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:307 entry_SYSENTER_compat_after_hwframe+0x84/0x8e other info that might help us debug this: Chain exists of: &sb->s_type->i_mutex_key#25 --> &subsys->su_mutex --> tpg_instances_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(tpg_instances_lock); lock(&subsys->su_mutex); lock(tpg_instances_lock); lock(&sb->s_type->i_mutex_key#25); *** DEADLOCK *** locks held by syz.0.157/6767: 4, last CPU#0: #0: ffff8880243ce478 (sb_writers#14){.+.+}-{0:0}, at: filename_create+0x10d/0x400 fs/namei.c:5101 #1: ffff8880154243c0 (&sb->s_type->i_mutex_key#8/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:1071 [inline] #1: ffff8880154243c0 (&sb->s_type->i_mutex_key#8/1){+.+.}-{4:4}, at: __start_dirop fs/namei.c:2924 [inline] #1: ffff8880154243c0 (&sb->s_type->i_mutex_key#8/1){+.+.}-{4:4}, at: start_dirop fs/namei.c:2948 [inline] #1: ffff8880154243c0 (&sb->s_type->i_mutex_key#8/1){+.+.}-{4:4}, at: filename_create+0x1c0/0x400 fs/namei.c:5108 #2: ffffffff911ea508 (&subsys->su_mutex){+.+.}-{4:4}, at: configfs_mkdir+0x4c0/0xd40 fs/configfs/dir.c:1367 #3: ffffffff916ba660 (tpg_instances_lock){+.+.}-{4:4}, at: usbg_make_tpg+0x10b/0x610 drivers/usb/gadget/function/f_tcm.c:1669 stack backtrace: CPU: 0 UID: 0 PID: 6767 Comm: syz.0.157 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_circular_bug.cold+0x178/0x1be kernel/locking/lockdep.c:2087 check_noncircular+0x146/0x160 kernel/locking/lockdep.c:2219 check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 down_write+0x86/0x1f0 kernel/locking/rwsem.c:1631 inode_lock include/linux/fs.h:1026 [inline] configfs_depend_item_unlocked+0xf3/0x6a0 fs/configfs/dir.c:1268 usbg_make_tpg+0x251/0x610 drivers/usb/gadget/function/f_tcm.c:1692 target_fabric_make_tpg+0xab/0x8c0 drivers/target/target_core_fabric_configfs.c:947 configfs_mkdir+0x525/0xd40 fs/configfs/dir.c:1369 vfs_mkdir+0x36d/0x8a0 fs/namei.c:5428 filename_mkdirat+0x4c4/0x630 fs/namei.c:5461 __do_sys_mkdirat fs/namei.c:5482 [inline] __se_sys_mkdirat fs/namei.c:5479 [inline] __ia32_sys_mkdirat+0x88/0xc0 fs/namei.c:5479 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x14b/0x8c0 arch/x86/entry/syscall_32.c:282 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:307 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf73cefbc Code: d2 74 05 c1 e8 0c 89 02 8b 5d fc 31 c0 c9 c3 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 2e 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 58 b8 RSP: 002b:00000000f53e650c EFLAGS: 00000292 ORIG_RAX: 0000000000000128 RAX: ffffffffffffffda RBX: 00000000ffffff9c RCX: 0000000080000680 RDX: 00000000000001ff RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 ---------------- Code disassembly (best guess): 0: d2 74 05 c1 shlb %cl,-0x3f(%rbp,%rax,1) 4: e8 0c 89 02 8b call 0x8b028915 9: 5d pop %rbp a: fc cld b: 31 c0 xor %eax,%eax d: c9 leave e: c3 ret f: 90 nop 10: 90 nop 11: 90 nop 12: 90 nop 13: 90 nop 14: 90 nop 15: 90 nop 16: 90 nop 17: 90 nop 18: 90 nop 19: 90 nop 1a: 90 nop 1b: 90 nop 1c: 90 nop 1d: 90 nop 1e: 0f 1f 00 nopl (%rax) 21: 51 push %rcx 22: 52 push %rdx 23: 55 push %rbp 24: 89 e5 mov %esp,%ebp 26: 0f 34 sysenter 28: cd 80 int $0x80 * 2a: 5d pop %rbp <-- trapping instruction 2b: 5a pop %rdx 2c: 59 pop %rcx 2d: c3 ret 2e: 90 nop 2f: 2e 8d b4 26 00 00 00 cs lea 0x0(%rsi,%riz,1),%esi 36: 00 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 3e: 58 pop %rax 3f: b8 .byte 0xb8