====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ syz.6.1476/10206 is trying to acquire lock: ffffffff91639908 (gadget_subsys.su_mutex){+.+.}-{4:4}, at: configfs_rmdir+0x5ae/0x950 fs/configfs/dir.c:1565 but task is already holding lock: ffff8880401d7800 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: inode_lock include/linux/fs.h:1027 [inline] ffff8880401d7800 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: vfs_rmdir fs/namei.c:5518 [inline] ffff8880401d7800 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: vfs_rmdir+0xed/0x8e0 fs/namei.c:5506 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&sb->s_type->i_mutex_key#24){++++}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 down_write+0x86/0x1f0 kernel/locking/rwsem.c:1631 inode_lock include/linux/fs.h:1027 [inline] configfs_depend_item_unlocked+0xf3/0x6a0 fs/configfs/dir.c:1268 usbg_make_tpg+0x251/0x610 drivers/usb/gadget/function/f_tcm.c:1692 target_fabric_make_tpg+0xab/0x8c0 drivers/target/target_core_fabric_configfs.c:947 configfs_mkdir+0x525/0xd40 fs/configfs/dir.c:1369 vfs_mkdir+0x36d/0x8a0 fs/namei.c:5428 filename_mkdirat+0x4c4/0x630 fs/namei.c:5461 __do_sys_mkdirat fs/namei.c:5482 [inline] __se_sys_mkdirat fs/namei.c:5479 [inline] __x64_sys_mkdirat+0x89/0xc0 fs/namei.c:5479 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (tpg_instances_lock){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821 tcm_alloc_inst+0x5f/0x1e0 drivers/usb/gadget/function/f_tcm.c:2687 try_get_usb_function_instance+0x136/0x1f0 drivers/usb/gadget/functions.c:28 usb_get_function_instance+0x16/0x70 drivers/usb/gadget/functions.c:44 function_make+0x18c/0x3f0 drivers/usb/gadget/configfs.c:626 configfs_mkdir+0x525/0xd40 fs/configfs/dir.c:1369 vfs_mkdir+0x36d/0x8a0 fs/namei.c:5428 filename_mkdirat+0x4c4/0x630 fs/namei.c:5461 __do_sys_mkdirat fs/namei.c:5482 [inline] __se_sys_mkdirat fs/namei.c:5479 [inline] __x64_sys_mkdirat+0x89/0xc0 fs/namei.c:5479 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (func_lock){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821 try_get_usb_function_instance+0x26/0x1f0 drivers/usb/gadget/functions.c:18 usb_get_function_instance+0x16/0x70 drivers/usb/gadget/functions.c:44 function_make+0x18c/0x3f0 drivers/usb/gadget/configfs.c:626 configfs_mkdir+0x525/0xd40 fs/configfs/dir.c:1369 vfs_mkdir+0x36d/0x8a0 fs/namei.c:5428 filename_mkdirat+0x4c4/0x630 fs/namei.c:5461 __do_sys_mkdirat fs/namei.c:5482 [inline] __se_sys_mkdirat fs/namei.c:5479 [inline] __x64_sys_mkdirat+0x89/0xc0 fs/namei.c:5479 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (gadget_subsys.su_mutex){+.+.}-{4:4}: check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821 configfs_rmdir+0x5ae/0x950 fs/configfs/dir.c:1565 vfs_rmdir fs/namei.c:5533 [inline] vfs_rmdir+0x328/0x8e0 fs/namei.c:5506 filename_rmdir+0x31a/0x610 fs/namei.c:5590 __do_sys_rmdir fs/namei.c:5613 [inline] __se_sys_rmdir fs/namei.c:5610 [inline] __x64_sys_rmdir+0x46/0x70 fs/namei.c:5610 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: gadget_subsys.su_mutex --> 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(gadget_subsys.su_mutex); *** DEADLOCK *** locks held by syz.6.1476/10206: 3, on CPU#2: #0: ffff888026978478 (sb_writers#13){.+.+}-{0:0}, at: filename_rmdir+0x1ff/0x610 fs/namei.c:5579 #1: ffff88805b96b0c0 (&default_group_class[depth - 1]#2/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:1072 [inline] #1: ffff88805b96b0c0 (&default_group_class[depth - 1]#2/1){+.+.}-{4:4}, at: __start_dirop fs/namei.c:2924 [inline] #1: ffff88805b96b0c0 (&default_group_class[depth - 1]#2/1){+.+.}-{4:4}, at: start_dirop fs/namei.c:2948 [inline] #1: ffff88805b96b0c0 (&default_group_class[depth - 1]#2/1){+.+.}-{4:4}, at: filename_rmdir+0x258/0x610 fs/namei.c:5583 #2: ffff8880401d7800 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: inode_lock include/linux/fs.h:1027 [inline] #2: ffff8880401d7800 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: vfs_rmdir fs/namei.c:5518 [inline] #2: ffff8880401d7800 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: vfs_rmdir+0xed/0x8e0 fs/namei.c:5506 stack backtrace: CPU: 2 UID: 0 PID: 10206 Comm: syz.6.1476 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_circular_bug.cold+0x178/0x1be kernel/locking/lockdep.c:2087 check_noncircular+0x146/0x160 kernel/locking/lockdep.c:2219 check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821 configfs_rmdir+0x5ae/0x950 fs/configfs/dir.c:1565 vfs_rmdir fs/namei.c:5533 [inline] vfs_rmdir+0x328/0x8e0 fs/namei.c:5506 filename_rmdir+0x31a/0x610 fs/namei.c:5590 __do_sys_rmdir fs/namei.c:5613 [inline] __se_sys_rmdir fs/namei.c:5610 [inline] __x64_sys_rmdir+0x46/0x70 fs/namei.c:5610 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7faf3dba9559 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:00007faf3eabb028 EFLAGS: 00000246 ORIG_RAX: 0000000000000054 RAX: ffffffffffffffda RBX: 00007faf3de25fa0 RCX: 00007faf3dba9559 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000200000000340 RBP: 00007faf3dc38136 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007faf3de26038 R14: 00007faf3de25fa0 R15: 00007ffdcb8d7e28 config_item hid.usb0: cleaning up device class 'hidg': unregistering kobject: 'hidg' (ffff88804c04c850): auto cleanup 'remove' event kobject: 'hidg' (ffff88804c04c850): kobject_uevent_env kobject: 'hidg' (ffff88804c04c850): fill_kobj_path: path = '/class/hidg' kernfs hidg: removing kobject: 'hidg' (ffff88804c04c850): kobject_cleanup, parent 0000000000000000 kobject: 'hidg' (ffff88804c04c850): calling ktype release class 'hidg': release. class 'hidg' does not have a release() function, be careful kobject: 'hidg': free name kcov: kcov_task_exit: t = ffff8880319a2580, kcov->t = ffff8880319a2580 ffff888058df8000 name hci0 bus 0 hci0: Updating devcoredump state from IDLE to IDLE. hci0: err 0x13 hci0 ffff888058df8000 hci0: hci0: err 0x13 hci0: cancelling interleave scan All LE pending actions cleared hdev hci0 hcon ffff88802ee58000 reason 22 hcon ffff88802ee58000 conn ffff88804cd17800, err 103 hci0 hcon ffff88802ee58000 chan ffff88805ab38400 hci0 hcon ffff88802ee58000 handle 200 hci0: hcon ffff88802ee58000 hcon ffff88802ee58000 hci0: conn ffff88802ee58000 device: 'hci0:200': device_unregister kernfs runtime_status: removing kernfs control: removing kernfs runtime_suspended_time: removing kernfs runtime_active_time: removing kernfs autosuspend_delay_ms: removing kernfs power: removing kernfs device: removing kernfs subsystem: removing kernfs hci0:200: removing kernfs uevent: removing PM: Removing info for No Bus:hci0:200 kobject: 'hci0:200' (ffff88802ee58cf0): kobject_uevent_env kobject: 'hci0:200' (ffff88802ee58cf0): fill_kobj_path: path = '/devices/virtual/bluetooth/hci0/hci0:200' kernfs hci0:200: removing kobject: 'hci0:200' (ffff88802ee58cf0): kobject_cleanup, parent 0000000000000000 kobject: 'hci0:200' (ffff88802ee58cf0): calling ktype release kobject: 'hci0:200': free name hci0 orig refcnt 11 hcon ffff888026c54000 reason 22 hcon ffff888026c54000 conn ffff88804cd11000, err 103 hci0 hcon ffff888026c54000 chan ffff88803fea9b00 hci0 hcon ffff888026c54000 handle 201 hci0: hcon ffff888026c54000 hcon ffff888026c54000 hci0: conn ffff888026c54000 device: 'hci0:201': device_unregister kernfs runtime_status: removing kernfs control: removing kernfs runtime_suspended_time: removing kernfs runtime_active_time: removing kernfs autosuspend_delay_ms: removing kernfs power: removing kernfs device: removing kernfs subsystem: removing kernfs hci0:201: removing kernfs uevent: removing PM: Removing info for No Bus:hci0:201 kobject: 'hci0:201' (ffff888026c54cf0): kobject_uevent_env kobject: 'hci0:201' (ffff888026c54cf0): fill_kobj_path: path = '/devices/virtual/bluetooth/hci0/hci0:201' kernfs hci0:201: removing kobject: 'hci0:201' (ffff888026c54cf0): kobject_cleanup, parent 0000000000000000 kobject: 'hci0:201' (ffff888026c54cf0): calling ktype release kobject: 'hci0:201': free name hci0 orig refcnt 7 hdev hci0 event 4 hdev 0000000000000000 len 8 hci0: Cleanup of MSFT extension hdev hci0 event 8 hci0 orig refcnt 6 channel 3 len 6 channel 3 len 8 hdev hci0 event 2 hdev 0000000000000000 len 8 kernfs runtime_status: removing kernfs control: removing kernfs runtime_suspended_time: removing kernfs runtime_active_time: removing kernfs autosuspend_delay_ms: removing kernfs power: removing kernfs device: removing kernfs subsystem: removing kernfs rfkill56: removing kernfs uevent: removing kernfs name: removing kernfs type: removing kernfs index: removing kernfs persistent: removing kernfs state: removing kernfs soft: removing kernfs hard: removing kernfs hard_block_reasons: removing PM: Removing info for No Bus:rfkill56 kobject: 'rfkill56' (ffff88802fe54118): kobject_uevent_env kobject: 'rfkill56' (ffff88802fe54118): fill_kobj_path: path = '/devices/virtual/bluetooth/hci0/rfkill56' kernfs rfkill56: removing kobject: 'rfkill56' (ffff88802fe54118): kobject_cleanup, parent 0000000000000000 kobject: 'rfkill56' (ffff88802fe54118): calling ktype release kobject: 'rfkill56': free name kernfs runtime_status: removing kernfs control: removing kernfs runtime_suspended_time: removing kernfs runtime_active_time: removing kernfs autosuspend_delay_ms: removing kernfs power: removing kernfs subsystem: removing kernfs hci0: removing kernfs uevent: removing kernfs reset: removing PM: Removing info for No Bus:hci0 kobject: 'hci0' (ffff888058df9538): kobject_uevent_env kobject: 'hci0' (ffff888058df9538): fill_kobj_path: path = '/devices/virtual/bluetooth/hci0' kernfs hci0: removing hci0 orig refcnt 2 kobject: 'hci0' (ffff888058df9538): kobject_cleanup, parent 0000000000000000 kobject: 'hci0' (ffff888058df9538): calling ktype release All LE connection parameters were removed hci0: Unregister MSFT extension kobject: 'hci0': free name syz_tun: bond_netdev_event received NETDEV_GOING_DOWN net syz_tun: siw: event 10 tipc: Resetting bearer In tnode_resize ffff888059ed8e20 inflate_threshold=50 threshold=25 Deleting ac1414aa/32 dsfield=0x00 t=ffff88802a5fc138