====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.2.23/5955 is trying to acquire lock: ffff888020045ab0 (&sb->s_type->i_mutex_key#20){++++}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline] ffff888020045ab0 (&sb->s_type->i_mutex_key#20){++++}-{3:3}, at: configfs_depend_item_unlocked+0x157/0x430 fs/configfs/dir.c:1255 but task is already holding lock: ffff88802f99a520 (&opts->dep_lock){+.+.}-{3:3}, at: usbg_make_tpg+0x148/0x580 drivers/usb/gadget/function/f_tcm.c:1333 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&opts->dep_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747 tcm_bind+0x9c/0x3f0 drivers/usb/gadget/function/f_tcm.c:1947 usb_add_function+0x2dd/0x980 drivers/usb/gadget/composite.c:333 configfs_composite_bind+0xde4/0x13f0 drivers/usb/gadget/configfs.c:1800 gadget_bind_driver+0x2b3/0x770 drivers/usb/gadget/udc/core.c:1651 call_driver_probe drivers/base/dd.c:-1 [inline] really_probe+0x247/0xae0 drivers/base/dd.c:717 __driver_probe_device+0x1f5/0x390 drivers/base/dd.c:879 driver_probe_device+0x4f/0x420 drivers/base/dd.c:909 __driver_attach+0x444/0x6d0 drivers/base/dd.c:1295 bus_for_each_dev+0x235/0x2b0 drivers/base/bus.c:370 bus_add_driver+0x340/0x630 drivers/base/bus.c:723 driver_register+0x23a/0x310 drivers/base/driver.c:246 usb_gadget_register_driver_owner+0xf9/0x270 drivers/usb/gadget/udc/core.c:1730 gadget_dev_desc_UDC_store+0x1c7/0x2e0 drivers/usb/gadget/configfs.c:300 flush_write_buffer fs/configfs/file.c:207 [inline] configfs_write_iter+0x312/0x400 fs/configfs/file.c:229 call_write_iter include/linux/fs.h:2018 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x474/0x9a0 fs/read_write.c:584 ksys_write+0x151/0x260 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #1 (&gi->lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747 config_usb_cfg_link+0x59/0x250 drivers/usb/gadget/configfs.c:439 configfs_symlink+0x5a5/0xfe0 fs/configfs/symlink.c:202 vfs_symlink+0x138/0x2b0 fs/namei.c:4528 do_symlinkat+0x1ba/0x400 fs/namei.c:4554 __do_sys_symlinkat fs/namei.c:4570 [inline] __se_sys_symlinkat fs/namei.c:4567 [inline] __x64_sys_symlinkat+0x99/0xb0 fs/namei.c:4567 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #0 (&sb->s_type->i_mutex_key#20){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x37ef/0x7d80 kernel/locking/lockdep.c:5137 lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754 down_write+0x97/0x200 kernel/locking/rwsem.c:1573 inode_lock include/linux/fs.h:804 [inline] configfs_depend_item_unlocked+0x157/0x430 fs/configfs/dir.c:1255 usbg_make_tpg+0x1f7/0x580 drivers/usb/gadget/function/f_tcm.c:1341 target_fabric_make_tpg+0xa4/0x6d0 drivers/target/target_core_fabric_configfs.c:939 configfs_mkdir+0x515/0x9e0 fs/configfs/dir.c:1360 vfs_mkdir+0x2a5/0x470 fs/namei.c:4168 do_mkdirat+0x1dc/0x450 fs/namei.c:4191 __do_sys_mkdirat fs/namei.c:4206 [inline] __se_sys_mkdirat fs/namei.c:4204 [inline] __x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4204 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x55/0xb0 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#20 --> &gi->lock --> &opts->dep_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&opts->dep_lock); lock(&gi->lock); lock(&opts->dep_lock); lock(&sb->s_type->i_mutex_key#20); *** DEADLOCK *** 5 locks held by syz.2.23/5955: #0: ffff888018b2c418 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:412 #1: ffff88805dac9090 (&sb->s_type->i_mutex_key#7/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:839 [inline] #1: ffff88805dac9090 (&sb->s_type->i_mutex_key#7/1){+.+.}-{3:3}, at: filename_create+0x20f/0x450 fs/namei.c:3937 #2: ffffffff8db2b830 (&subsys->su_mutex ){+.+.}-{3:3}, at: configfs_mkdir+0x4b9/0x9e0 fs/configfs/dir.c:1358 #3: ffffffff8de58f08 (tpg_instances_lock){+.+.}-{3:3}, at: usbg_make_tpg+0xf8/0x580 drivers/usb/gadget/function/f_tcm.c:1324 #4: ffff88802f99a520 (&opts->dep_lock){+.+.}-{3:3}, at: usbg_make_tpg+0x148/0x580 drivers/usb/gadget/function/f_tcm.c:1333 stack backtrace: CPU: 1 PID: 5955 Comm: syz.2.23 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026 Call Trace: dump_stack_lvl+0x18c/0x250 lib/dump_stack.c:106 check_noncircular+0x2fc/0x400 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x37ef/0x7d80 kernel/locking/lockdep.c:5137 lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754 down_write+0x97/0x200 kernel/locking/rwsem.c:1573 inode_lock include/linux/fs.h:804 [inline] configfs_depend_item_unlocked+0x157/0x430 fs/configfs/dir.c:1255 usbg_make_tpg+0x1f7/0x580 drivers/usb/gadget/function/f_tcm.c:1341 target_fabric_make_tpg+0xa4/0x6d0 drivers/target/target_core_fabric_configfs.c:939 configfs_mkdir+0x515/0x9e0 fs/configfs/dir.c:1360 vfs_mkdir+0x2a5/0x470 fs/namei.c:4168 do_mkdirat+0x1dc/0x450 fs/namei.c:4191 __do_sys_mkdirat fs/namei.c:4206 [inline] __se_sys_mkdirat fs/namei.c:4204 [inline] __x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4204 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7fdb8e99e019 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:00007fdb8f93a028 EFLAGS: 00000246 ORIG_RAX: 0000000000000102 RAX: ffffffffffffffda RBX: 00007fdb8ec25fa0 RCX: 00007fdb8e99e019 RDX: 00000000000001ff RSI: 0000200000000680 RDI: ffffffffffffff9c RBP: 00007fdb8ea3500c R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fdb8ec26038 R14: 00007fdb8ec25fa0 R15: 00007ffe281bb478