======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz-executor576/6006 is trying to acquire lock:
ffff888024880f80 (&sb->s_type->i_mutex_key#25){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:1024 [inline]
ffff888024880f80 (&sb->s_type->i_mutex_key#25){+.+.}-{4:4}, at: configfs_depend_item_unlocked+0x153/0x420 fs/configfs/dir.c:1268
but task is already holding lock:
ffffffff90c72080 (tpg_instances_lock){+.+.}-{4:4}, at: usbg_make_tpg+0xf8/0x550 drivers/usb/gadget/function/f_tcm.c:1669
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (tpg_instances_lock){+.+.}-{4:4}:
__mutex_lock_common kernel/locking/mutex.c:646 [inline]
__mutex_lock+0x19d/0x1550 kernel/locking/mutex.c:821
tcm_free_inst+0x1b/0x50 drivers/usb/gadget/function/f_tcm.c:2613
usb_put_function_instance+0x95/0xc0 drivers/usb/gadget/functions.c:77
config_item_cleanup fs/configfs/item.c:128 [inline]
config_item_release+0x13a/0x2d0 fs/configfs/item.c:137
configfs_rmdir+0x885/0x950 fs/configfs/dir.c:1580
vfs_rmdir+0x3e6/0x6a0 fs/namei.c:5514
filename_rmdir+0x292/0x520 fs/namei.c:5571
__do_sys_rmdir fs/namei.c:5594 [inline]
__se_sys_rmdir+0x2e/0x140 fs/namei.c:5591
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (&sb->s_type->i_mutex_key#25){+.+.}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3209 [inline]
check_prevs_add kernel/locking/lockdep.c:3328 [inline]
validate_chain kernel/locking/lockdep.c:3952 [inline]
__lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288
lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942
down_write+0x96/0x200 kernel/locking/rwsem.c:1631
inode_lock include/linux/fs.h:1024 [inline]
configfs_depend_item_unlocked+0x153/0x420 fs/configfs/dir.c:1268
usbg_make_tpg+0x1e0/0x550 drivers/usb/gadget/function/f_tcm.c:1692
target_fabric_make_tpg+0xa8/0x6d0 drivers/target/target_core_fabric_configfs.c:947
configfs_mkdir+0x4f6/0x9e0 fs/configfs/dir.c:1369
vfs_mkdir+0x40c/0x620 fs/namei.c:5409
filename_mkdirat+0x285/0x510 fs/namei.c:5442
__do_sys_mkdir fs/namei.c:5469 [inline]
__se_sys_mkdir+0x34/0x150 fs/namei.c:5466
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(tpg_instances_lock);
lock(&sb->s_type->i_mutex_key#25);
lock(tpg_instances_lock);
lock(&sb->s_type->i_mutex_key#25);
*** DEADLOCK ***
locks held by syz-executor576/6006: 4, last CPU#1:
#0: ffff88801e7ca460 (sb_writers#12){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:531
#1: ffff88803531c140 (&sb->s_type->i_mutex_key#8/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:1069 [inline]
#1: ffff88803531c140 (&sb->s_type->i_mutex_key#8/1){+.+.}-{4:4}, at: __start_dirop fs/namei.c:2918 [inline]
#1: ffff88803531c140 (&sb->s_type->i_mutex_key#8/1){+.+.}-{4:4}, at: start_dirop fs/namei.c:2942 [inline]
#1: ffff88803531c140 (&sb->s_type->i_mutex_key#8/1){+.+.}-{4:4}, at: filename_create+0x200/0x370 fs/namei.c:5091
#2: ffffffff9093c7c8 (&subsys->su_mutex){+.+.}-{4:4}, at: configfs_mkdir+0x4b0/0x9e0 fs/configfs/dir.c:1367
#3: ffffffff90c72080 (tpg_instances_lock){+.+.}-{4:4}, at: usbg_make_tpg+0xf8/0x550 drivers/usb/gadget/function/f_tcm.c:1669
stack backtrace:
CPU: 1 UID: 0 PID: 6006 Comm: syz-executor576 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/16/2026
Call Trace:
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2087
check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2219
check_prev_add kernel/locking/lockdep.c:3209 [inline]
check_prevs_add kernel/locking/lockdep.c:3328 [inline]
validate_chain kernel/locking/lockdep.c:3952 [inline]
__lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288
lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942
down_write+0x96/0x200 kernel/locking/rwsem.c:1631
inode_lock include/linux/fs.h:1024 [inline]
configfs_depend_item_unlocked+0x153/0x420 fs/configfs/dir.c:1268
usbg_make_tpg+0x1e0/0x550 drivers/usb/gadget/function/f_tcm.c:1692
target_fabric_make_tpg+0xa8/0x6d0 drivers/target/target_core_fabric_configfs.c:947
configfs_mkdir+0x4f6/0x9e0 fs/configfs/dir.c:1369
vfs_mkdir+0x40c/0x620 fs/namei.c:5409
filename_mkdirat+0x285/0x510 fs/namei.c:5442
__do_sys_mkdir fs/namei.c:5469 [inline]
__se_sys_mkdir+0x34/0x150 fs/namei.c:5466
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f49bcbd23c7
Code: 77 01 c3 48 c7 c2 d0 ff ff ff f7 d8 64 89 02 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 b8 53 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 d0 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007f49bc39c188 EFLAGS: 00000202 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 00007f49bcc414b0 RCX: 00007f49bcbd23c7
RDX: ffffffffffffffd0 RSI: 00000000000001ff RDI: 00007f49bcc414b0
RBP: 0000000000000021 R08: 0000000000000000 R09: 00007f49bc39c6c0
R10: 0000000000000008 R11: 0000000000000202 R12: ffffffffffffffd0
R13: 0000000000000010 R14: 00007ffc6127cbd0 R15: 00007ffc6127ccb8
Oops: general protection fault, probably for non-canonical address 0xdffffc000000000c: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000060-0x0000000000000067]
CPU: 1 UID: 0 PID: 6006 Comm: syz-executor576 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/16/2026
RIP: 0010:configfs_depend_item_unlocked+0x96/0x420 fs/configfs/dir.c:1255
Code: df e8 ae 89 00 00 89 c5 31 ff 89 c6 e8 63 e9 4b ff 85 ed 74 0a e8 5a e4 4b ff 4d 89 fd eb 6c 48 8d 7b 60 48 89 f8 48 c1 e8 03 <42> 80 3c 30 00 74 05 e8 7e c1 bc ff 4c 8b 6b 60 48 89 df e8 72 89
RSP: 0018:ffffc90003fafad8 EFLAGS: 00010216
RAX: 000000000000000c RBX: 0000000000000000 RCX: ffff88802ad95dc0
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000060
RBP: 0000000000000000 R08: ffffffff917a747f R09: 1ffffffff22f4e8f
R10: dffffc0000000000 R11: fffffbfff22f4e90 R12: ffffffff9093c6e0
R13: 1ffff920007f5f6c R14: dffffc0000000000 R15: ffff88802958bc00
FS: 00007f49bc39c6c0(0000) GS:ffff888123bbf000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f49bcba512d CR3: 00000000729ed000 CR4: 0000000000350ef0
Call Trace:
usbg_make_tpg+0x1e0/0x550 drivers/usb/gadget/function/f_tcm.c:1692
target_fabric_make_tpg+0xa8/0x6d0 drivers/target/target_core_fabric_configfs.c:947
configfs_mkdir+0x4f6/0x9e0 fs/configfs/dir.c:1369
vfs_mkdir+0x40c/0x620 fs/namei.c:5409
filename_mkdirat+0x285/0x510 fs/namei.c:5442
__do_sys_mkdir fs/namei.c:5469 [inline]
__se_sys_mkdir+0x34/0x150 fs/namei.c:5466
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f49bcbd23c7
Code: 77 01 c3 48 c7 c2 d0 ff ff ff f7 d8 64 89 02 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 b8 53 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 d0 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007f49bc39c188 EFLAGS: 00000202 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 00007f49bcc414b0 RCX: 00007f49bcbd23c7
RDX: ffffffffffffffd0 RSI: 00000000000001ff RDI: 00007f49bcc414b0
RBP: 0000000000000021 R08: 0000000000000000 R09: 00007f49bc39c6c0
R10: 0000000000000008 R11: 0000000000000202 R12: ffffffffffffffd0
R13: 0000000000000010 R14: 00007ffc6127cbd0 R15: 00007ffc6127ccb8
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:configfs_depend_item_unlocked+0x96/0x420 fs/configfs/dir.c:1255
Code: df e8 ae 89 00 00 89 c5 31 ff 89 c6 e8 63 e9 4b ff 85 ed 74 0a e8 5a e4 4b ff 4d 89 fd eb 6c 48 8d 7b 60 48 89 f8 48 c1 e8 03 <42> 80 3c 30 00 74 05 e8 7e c1 bc ff 4c 8b 6b 60 48 89 df e8 72 89
RSP: 0018:ffffc90003fafad8 EFLAGS: 00010216
RAX: 000000000000000c RBX: 0000000000000000 RCX: ffff88802ad95dc0
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000060
RBP: 0000000000000000 R08: ffffffff917a747f R09: 1ffffffff22f4e8f
R10: dffffc0000000000 R11: fffffbfff22f4e90 R12: ffffffff9093c6e0
R13: 1ffff920007f5f6c R14: dffffc0000000000 R15: ffff88802958bc00
FS: 00007f49bc39c6c0(0000) GS:ffff888123bbf000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f49bcba512d CR3: 00000000729ed000 CR4: 0000000000350ef0
----------------
Code disassembly (best guess), 1 bytes skipped:
0: e8 ae 89 00 00 call 0x89b3
5: 89 c5 mov %eax,%ebp
7: 31 ff xor %edi,%edi
9: 89 c6 mov %eax,%esi
b: e8 63 e9 4b ff call 0xff4be973
10: 85 ed test %ebp,%ebp
12: 74 0a je 0x1e
14: e8 5a e4 4b ff call 0xff4be473
19: 4d 89 fd mov %r15,%r13
1c: eb 6c jmp 0x8a
1e: 48 8d 7b 60 lea 0x60(%rbx),%rdi
22: 48 89 f8 mov %rdi,%rax
25: 48 c1 e8 03 shr $0x3,%rax
* 29: 42 80 3c 30 00 cmpb $0x0,(%rax,%r14,1) <-- trapping instruction
2e: 74 05 je 0x35
30: e8 7e c1 bc ff call 0xffbcc1b3
35: 4c 8b 6b 60 mov 0x60(%rbx),%r13
39: 48 89 df mov %rbx,%rdi
3c: e8 .byte 0xe8
3d: 72 89 jb 0xffffffc8