====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.1.2938/16103 is trying to acquire lock: ffff888148cf5080 (&sb->s_type->i_mutex_key#38){++++}-{3:3}, at: inode_lock include/linux/fs.h:764 [inline] ffff888148cf5080 (&sb->s_type->i_mutex_key#38){++++}-{3:3}, at: configfs_depend_item_unlocked+0x14c/0x450 fs/configfs/dir.c:1251 but task is already holding lock: ffffffff8e6067e8 (tpg_instances_lock){+.+.}-{3:3}, at: usbg_make_tpg+0xf5/0x550 drivers/usb/gadget/function/f_tcm.c:1348 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (tpg_instances_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747 tcm_alloc_inst+0x61/0x190 drivers/usb/gadget/function/f_tcm.c:2366 try_get_usb_function_instance drivers/usb/gadget/functions.c:28 [inline] usb_get_function_instance+0xd9/0x2e0 drivers/usb/gadget/functions.c:44 function_make+0x118/0x350 drivers/usb/gadget/configfs.c:615 configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1356 vfs_mkdir+0x386/0x570 fs/namei.c:4157 do_mkdirat+0x1d8/0x440 fs/namei.c:4182 __do_sys_mkdirat fs/namei.c:4197 [inline] __se_sys_mkdirat fs/namei.c:4195 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4195 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #2 (func_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747 try_get_usb_function_instance drivers/usb/gadget/functions.c:18 [inline] usb_get_function_instance+0x2a/0x2e0 drivers/usb/gadget/functions.c:44 function_make+0x118/0x350 drivers/usb/gadget/configfs.c:615 configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1356 vfs_mkdir+0x386/0x570 fs/namei.c:4157 do_mkdirat+0x1d8/0x440 fs/namei.c:4182 __do_sys_mkdirat fs/namei.c:4197 [inline] __se_sys_mkdirat fs/namei.c:4195 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4195 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #1 (gadget_subsys.su_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747 uvcg_streaming_header_allow_link+0x6d/0x4a0 drivers/usb/gadget/function/uvc_configfs.c:884 configfs_symlink+0x5a4/0x13c0 fs/configfs/symlink.c:202 vfs_symlink+0x245/0x3d0 fs/namei.c:4522 do_symlinkat+0x1b6/0x400 fs/namei.c:4551 __do_sys_symlinkat fs/namei.c:4568 [inline] __se_sys_symlinkat fs/namei.c:4565 [inline] __x64_sys_symlinkat+0x95/0xa0 fs/namei.c:4565 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #0 (&sb->s_type->i_mutex_key#38){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3162 [inline] check_prevs_add kernel/locking/lockdep.c:3281 [inline] validate_chain kernel/locking/lockdep.c:3897 [inline] __lock_acquire+0x3a03/0x7ea0 kernel/locking/lockdep.c:5171 lock_acquire+0x1bc/0x4a0 kernel/locking/lockdep.c:5790 down_write+0x36/0x60 kernel/locking/rwsem.c:1573 inode_lock include/linux/fs.h:764 [inline] configfs_depend_item_unlocked+0x14c/0x450 fs/configfs/dir.c:1251 usbg_make_tpg+0x1dd/0x550 drivers/usb/gadget/function/f_tcm.c:1371 target_fabric_make_tpg+0xa0/0x6d0 drivers/target/target_core_fabric_configfs.c:913 configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1356 vfs_mkdir+0x386/0x570 fs/namei.c:4157 do_mkdirat+0x1d8/0x440 fs/namei.c:4182 __do_sys_mkdirat fs/namei.c:4197 [inline] __se_sys_mkdirat fs/namei.c:4195 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4195 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 other info that might help us debug this: Chain exists of: &sb->s_type->i_mutex_key#38 --> func_lock --> tpg_instances_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(tpg_instances_lock); lock(func_lock); lock(tpg_instances_lock); lock(&sb->s_type->i_mutex_key#38); *** DEADLOCK *** 4 locks held by syz.1.2938/16103: #0: ffff888146af0460 (sb_writers#30){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:402 #1: ffff8880723224c0 (&sb->s_type->i_mutex_key#7/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:799 [inline] #1: ffff8880723224c0 (&sb->s_type->i_mutex_key#7/1){+.+.}-{3:3}, at: filename_create+0x20b/0x450 fs/namei.c:3927 #2: ffffffff8e2ea510 (&subsys->su_mutex){+.+.}-{3:3}, at: configfs_mkdir+0x4b5/0x9e0 fs/configfs/dir.c:1354 #3: ffffffff8e6067e8 (tpg_instances_lock){+.+.}-{3:3}, at: usbg_make_tpg+0xf5/0x550 drivers/usb/gadget/function/f_tcm.c:1348 stack backtrace: CPU: 0 PID: 16103 Comm: syz.1.2938 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026 Call Trace: dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106 check_noncircular+0x2f8/0x400 kernel/locking/lockdep.c:2215 check_prev_add kernel/locking/lockdep.c:3162 [inline] check_prevs_add kernel/locking/lockdep.c:3281 [inline] validate_chain kernel/locking/lockdep.c:3897 [inline] __lock_acquire+0x3a03/0x7ea0 kernel/locking/lockdep.c:5171 lock_acquire+0x1bc/0x4a0 kernel/locking/lockdep.c:5790 down_write+0x36/0x60 kernel/locking/rwsem.c:1573 inode_lock include/linux/fs.h:764 [inline] configfs_depend_item_unlocked+0x14c/0x450 fs/configfs/dir.c:1251 usbg_make_tpg+0x1dd/0x550 drivers/usb/gadget/function/f_tcm.c:1371 target_fabric_make_tpg+0xa0/0x6d0 drivers/target/target_core_fabric_configfs.c:913 configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1356 vfs_mkdir+0x386/0x570 fs/namei.c:4157 do_mkdirat+0x1d8/0x440 fs/namei.c:4182 __do_sys_mkdirat fs/namei.c:4197 [inline] __se_sys_mkdirat fs/namei.c:4195 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4195 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f89bf19e559 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f89bd3f6028 EFLAGS: 00000246 ORIG_RAX: 0000000000000102 RAX: ffffffffffffffda RBX: 00007f89bf425fa0 RCX: 00007f89bf19e559 RDX: 00000000000001ff RSI: 0000200000000380 RDI: ffffffffffffff9c RBP: 00007f89bf2358b0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f89bf426038 R14: 00007f89bf425fa0 R15: 00007ffe71042b18 TARGET_CORE[usb_gadget]: Allocated portal_group for endpoint: 6001405c935d7912, Proto: 6, Portal Tag: 1 kcov: kcov_task_exit: t = ffff88802cd00000, kcov->t = ffff88802cd00000