====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.2.975/7463 is trying to acquire lock: ffff8880725a6f78 (&p->frag_sem){++++}-{3:3}, at: configfs_rmdir+0x3e0/0x980 fs/configfs/dir.c:1530 but task is already holding lock: ffff8880560ec150 (&sb->s_type->i_mutex_key#21){++++}-{3:3}, at: inode_lock include/linux/fs.h:795 [inline] ffff8880560ec150 (&sb->s_type->i_mutex_key#21){++++}-{3:3}, at: vfs_rmdir+0xe1/0x410 fs/namei.c:4190 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (&sb->s_type->i_mutex_key#21){++++}-{3:3}: down_write+0x38/0x60 kernel/locking/rwsem.c:1551 inode_lock include/linux/fs.h:795 [inline] configfs_depend_item_unlocked+0x14c/0x450 fs/configfs/dir.c:1251 usbg_make_tpg+0x1dd/0x550 drivers/usb/gadget/function/f_tcm.c:1357 target_fabric_make_tpg+0xa0/0x6d0 drivers/target/target_core_fabric_configfs.c:845 configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1356 vfs_mkdir+0x386/0x570 fs/namei.c:4116 do_mkdirat+0x1dd/0x5c0 fs/namei.c:4141 __do_sys_mkdirat fs/namei.c:4156 [inline] __se_sys_mkdirat fs/namei.c:4154 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4154 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #3 (tpg_instances_lock){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 tcm_alloc_inst+0x61/0x190 drivers/usb/gadget/function/f_tcm.c:2371 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:610 configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1356 vfs_mkdir+0x386/0x570 fs/namei.c:4116 do_mkdirat+0x1dd/0x5c0 fs/namei.c:4141 __do_sys_mkdirat fs/namei.c:4156 [inline] __se_sys_mkdirat fs/namei.c:4154 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4154 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #2 (func_lock){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 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:610 configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1356 vfs_mkdir+0x386/0x570 fs/namei.c:4116 do_mkdirat+0x1dd/0x5c0 fs/namei.c:4141 __do_sys_mkdirat fs/namei.c:4156 [inline] __se_sys_mkdirat fs/namei.c:4154 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4154 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #1 (gadget_subsys.su_mutex){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 uvcg_frame_dw_frame_interval_store+0xde/0x9c0 drivers/usb/gadget/function/uvc_configfs.c:1336 flush_write_buffer fs/configfs/file.c:207 [inline] configfs_write_iter+0x30b/0x400 fs/configfs/file.c:229 call_write_iter include/linux/fs.h:2181 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0x748/0xd70 fs/read_write.c:594 ksys_write+0x153/0x260 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (&p->frag_sem){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3125 [inline] check_prevs_add kernel/locking/lockdep.c:3244 [inline] validate_chain kernel/locking/lockdep.c:3860 [inline] __lock_acquire+0x39b7/0x7e20 kernel/locking/lockdep.c:5134 lock_acquire+0x19f/0x400 kernel/locking/lockdep.c:5751 down_write_killable+0x46/0x90 kernel/locking/rwsem.c:1562 configfs_rmdir+0x3e0/0x980 fs/configfs/dir.c:1530 vfs_rmdir+0x19d/0x410 fs/namei.c:4200 do_rmdir+0x27f/0x710 fs/namei.c:4261 __do_sys_rmdir fs/namei.c:4280 [inline] __se_sys_rmdir fs/namei.c:4278 [inline] __x64_sys_rmdir+0x45/0x50 fs/namei.c:4278 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 other info that might help us debug this: Chain exists of: &p->frag_sem --> tpg_instances_lock --> &sb->s_type->i_mutex_key#21 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sb->s_type->i_mutex_key#21); lock(tpg_instances_lock); lock(&sb->s_type->i_mutex_key#21); lock(&p->frag_sem); *** DEADLOCK *** 3 locks held by syz.2.975/7463: #0: ffff88801ec14460 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:386 #1: ffff88805ee95fb0 (&default_group_class[depth - 1]#2/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:830 [inline] #1: ffff88805ee95fb0 (&default_group_class[depth - 1]#2/1){+.+.}-{3:3}, at: do_rmdir+0x1b0/0x710 fs/namei.c:4248 #2: ffff8880560ec150 (&sb->s_type->i_mutex_key#21){++++}-{3:3}, at: inode_lock include/linux/fs.h:795 [inline] #2: ffff8880560ec150 (&sb->s_type->i_mutex_key#21){++++}-{3:3}, at: vfs_rmdir+0xe1/0x410 fs/namei.c:4190 stack backtrace: CPU: 1 PID: 7463 Comm: syz.2.975 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026 Call Trace: dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106 check_noncircular+0x2f8/0x400 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3125 [inline] check_prevs_add kernel/locking/lockdep.c:3244 [inline] validate_chain kernel/locking/lockdep.c:3860 [inline] __lock_acquire+0x39b7/0x7e20 kernel/locking/lockdep.c:5134 lock_acquire+0x19f/0x400 kernel/locking/lockdep.c:5751 down_write_killable+0x46/0x90 kernel/locking/rwsem.c:1562 configfs_rmdir+0x3e0/0x980 fs/configfs/dir.c:1530 vfs_rmdir+0x19d/0x410 fs/namei.c:4200 do_rmdir+0x27f/0x710 fs/namei.c:4261 __do_sys_rmdir fs/namei.c:4280 [inline] __se_sys_rmdir fs/namei.c:4278 [inline] __x64_sys_rmdir+0x45/0x50 fs/namei.c:4278 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f20cc328a19 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:00007f20ca575028 EFLAGS: 00000246 ORIG_RAX: 0000000000000054 RAX: ffffffffffffffda RBX: 00007f20cc5b4fa0 RCX: 00007f20cc328a19 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000200000000a80 RBP: 00007f20cc3b8156 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f20cc5b5038 R14: 00007f20cc5b4fa0 R15: 00007ffc8786bfa8 printk: console [ttyGS0] disabled