====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.0.2617/15317 is trying to acquire lock: ffff888025c60578 (&p->frag_sem){++++}-{3:3}, at: configfs_rmdir+0x3e4/0x980 fs/configfs/dir.c:1534 but task is already holding lock: ffff88805df664d0 (&sb->s_type->i_mutex_key#24){++++}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline] ffff88805df664d0 (&sb->s_type->i_mutex_key#24){++++}-{3:3}, at: vfs_rmdir+0xee/0x4b0 fs/namei.c:4240 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (&sb->s_type->i_mutex_key#24){++++}-{3:3}: 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+0x1e1/0x550 drivers/usb/gadget/function/f_tcm.c:1347 target_fabric_make_tpg+0xa4/0x6d0 drivers/target/target_core_fabric_configfs.c:947 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 -> #3 (tpg_instances_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747 tcm_alloc_inst+0x65/0x190 drivers/usb/gadget/function/f_tcm.c:2335 try_get_usb_function_instance drivers/usb/gadget/functions.c:28 [inline] usb_get_function_instance+0xdd/0x2e0 drivers/usb/gadget/functions.c:44 function_make+0x11c/0x350 drivers/usb/gadget/configfs.c:625 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 -> #2 (func_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747 try_get_usb_function_instance drivers/usb/gadget/functions.c:18 [inline] usb_get_function_instance+0x2e/0x2e0 drivers/usb/gadget/functions.c:44 function_make+0x11c/0x350 drivers/usb/gadget/configfs.c:625 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 -> #1 (gadget_subsys.su_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747 uvcg_format_bma_controls_show drivers/usb/gadget/function/uvc_configfs.c:1678 [inline] uvcg_mjpeg_bma_controls_show+0x4d/0x130 drivers/usb/gadget/function/uvc_configfs.c:2601 fill_read_buffer fs/configfs/file.c:68 [inline] configfs_read_iter+0x29d/0x570 fs/configfs/file.c:88 __kernel_read+0x2e5/0x730 fs/read_write.c:428 integrity_kernel_read+0x8a/0xd0 security/integrity/iint.c:221 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline] ima_calc_file_hash+0xb1f/0x1960 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x4d4/0xa30 security/integrity/ima/ima_api.c:290 process_measurement+0x123a/0x1d50 security/integrity/ima/ima_main.c:370 ima_file_check+0xcc/0x110 security/integrity/ima/ima_main.c:568 do_open fs/namei.c:3685 [inline] path_openat+0x2910/0x3270 fs/namei.c:3844 do_filp_open+0x1f2/0x430 fs/namei.c:3871 do_sys_openat2+0x134/0x1d0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_openat fs/open.c:1453 [inline] __se_sys_openat fs/open.c:1448 [inline] __x64_sys_openat+0x139/0x160 fs/open.c:1448 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 (&p->frag_sem){++++}-{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:5756 down_write_killable+0xa7/0x230 kernel/locking/rwsem.c:1584 configfs_rmdir+0x3e4/0x980 fs/configfs/dir.c:1534 vfs_rmdir+0x352/0x4b0 fs/namei.c:4251 do_rmdir+0x29f/0x590 fs/namei.c:4310 __do_sys_rmdir fs/namei.c:4329 [inline] __se_sys_rmdir fs/namei.c:4327 [inline] __x64_sys_rmdir+0x49/0x50 fs/namei.c:4327 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: &p->frag_sem --> tpg_instances_lock --> &sb->s_type->i_mutex_key#24 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sb->s_type->i_mutex_key#24); lock(tpg_instances_lock); lock(&sb->s_type->i_mutex_key#24); lock(&p->frag_sem); *** DEADLOCK *** 3 locks held by syz.0.2617/15317: #0: ffff888017db8418 (sb_writers#20){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:412 #1: ffff888055a37910 (&default_group_class[depth - 1]#2/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:839 [inline] #1: ffff888055a37910 (&default_group_class[depth - 1]#2/1){+.+.}-{3:3}, at: do_rmdir+0x1c6/0x590 fs/namei.c:4298 #2: ffff88805df664d0 (&sb->s_type->i_mutex_key#24){++++}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline] #2: ffff88805df664d0 (&sb->s_type->i_mutex_key#24){++++}-{3:3}, at: vfs_rmdir+0xee/0x4b0 fs/namei.c:4240 stack backtrace: CPU: 0 PID: 15317 Comm: syz.0.2617 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/16/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:5756 down_write_killable+0xa7/0x230 kernel/locking/rwsem.c:1584 configfs_rmdir+0x3e4/0x980 fs/configfs/dir.c:1534 vfs_rmdir+0x352/0x4b0 fs/namei.c:4251 do_rmdir+0x29f/0x590 fs/namei.c:4310 __do_sys_rmdir fs/namei.c:4329 [inline] __se_sys_rmdir fs/namei.c:4327 [inline] __x64_sys_rmdir+0x49/0x50 fs/namei.c:4327 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:0x7f209eb9e159 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:00007f209fa7f028 EFLAGS: 00000246 ORIG_RAX: 0000000000000054 RAX: ffffffffffffffda RBX: 00007f209ee25fa0 RCX: 00007f209eb9e159 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000200000000180 RBP: 00007f209ec3506b R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f209ee26038 R14: 00007f209ee25fa0 R15: 00007ffd70cbb4e8