====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ syz.7.2447/13745 is trying to acquire lock: ffffffff91638d08 (gadget_subsys.su_mutex){+.+.}-{4:4}, at: configfs_rmdir+0x5ae/0x950 fs/configfs/dir.c:1565 but task is already holding lock: ffff888059ed7340 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: inode_lock include/linux/fs.h:1027 [inline] ffff888059ed7340 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: vfs_rmdir fs/namei.c:5518 [inline] ffff888059ed7340 (&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.7.2447/13745: 3, on CPU#0: #0: ffff888025c6a478 (sb_writers#14){.+.+}-{0:0}, at: filename_rmdir+0x1ff/0x610 fs/namei.c:5579 #1: ffff888059ee9900 (&default_group_class[depth - 1]#2/1){+.+.}-{4:4}, at: inode_lock_nested include/linux/fs.h:1072 [inline] #1: ffff888059ee9900 (&default_group_class[depth - 1]#2/1){+.+.}-{4:4}, at: __start_dirop fs/namei.c:2924 [inline] #1: ffff888059ee9900 (&default_group_class[depth - 1]#2/1){+.+.}-{4:4}, at: start_dirop fs/namei.c:2948 [inline] #1: ffff888059ee9900 (&default_group_class[depth - 1]#2/1){+.+.}-{4:4}, at: filename_rmdir+0x258/0x610 fs/namei.c:5583 #2: ffff888059ed7340 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: inode_lock include/linux/fs.h:1027 [inline] #2: ffff888059ed7340 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: vfs_rmdir fs/namei.c:5518 [inline] #2: ffff888059ed7340 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: vfs_rmdir+0xed/0x8e0 fs/namei.c:5506 stack backtrace: CPU: 0 UID: 0 PID: 13745 Comm: syz.7.2447 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:0x7f7e83fa9559 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:00007f7e84e25028 EFLAGS: 00000246 ORIG_RAX: 0000000000000054 RAX: ffffffffffffffda RBX: 00007f7e84225fa0 RCX: 00007f7e83fa9559 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000200000000400 RBP: 00007f7e84038136 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f7e84226038 R14: 00007f7e84225fa0 R15: 00007ffde5e3a648 config_item uvc.0: cleaning up config_item header: cleaning up config_item default: cleaning up config_item processing: cleaning up config_item default: cleaning up config_item camera: cleaning up config_item default: cleaning up config_item output: cleaning up config_item terminal: cleaning up config_item fs: cleaning up config_item ss: cleaning up config_item class: cleaning up config_item extensions: cleaning up config_item control: cleaning up config_item header: cleaning up config_item uncompressed: cleaning up config_item mjpeg: cleaning up config_item framebased: cleaning up config_item default: cleaning up config_item color_matching: cleaning up config_item fs: cleaning up config_item hs: cleaning up config_item ss: cleaning up config_item class: cleaning up config_item streaming: cleaning up kcov: kcov_task_exit: t = ffff888026f18000, kcov->t = ffff888026f18000 ffff888057854000 name hci0 bus 0 hci0: Updating devcoredump state from IDLE to IDLE. hci0: err 0x13 hci0 ffff888057854000 hci0: hci0: err 0x13 hci0: cancelling interleave scan 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 rfkill34: 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:rfkill34 kobject: 'rfkill34' (ffff888026f86118): kobject_uevent_env kobject: 'rfkill34' (ffff888026f86118): fill_kobj_path: path = '/devices/virtual/bluetooth/hci0/rfkill34' kernfs rfkill34: removing kobject: 'rfkill34' (ffff888026f86118): kobject_cleanup, parent 0000000000000000 kobject: 'rfkill34' (ffff888026f86118): calling ktype release kobject: 'rfkill34': 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' (ffff888057855538): kobject_uevent_env kobject: 'hci0' (ffff888057855538): fill_kobj_path: path = '/devices/virtual/bluetooth/hci0' kernfs hci0: removing hci0 orig refcnt 2 kobject: 'hci0' (ffff888057855538): kobject_cleanup, parent 0000000000000000 kobject: 'hci0' (ffff888057855538): 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 In tnode_resize ffff88802be36f20 inflate_threshold=50 threshold=25 In tnode_resize ffff88802799b820 inflate_threshold=50 threshold=25 In tnode_resize ffff88804a67fc20 inflate_threshold=50 threshold=25 In tnode_resize ffff88802ddf8d20 inflate_threshold=50 threshold=25 In tnode_resize ffff8880374b4020 inflate_threshold=50 threshold=25 In tnode_resize ffff88805c4bd120 inflate_threshold=50 threshold=25 In tnode_resize ffff888058e53b20 inflate_threshold=50 threshold=25 trie_flush found=1 In tnode_resize ffff88802be36f20 inflate_threshold=50 threshold=25 In tnode_resize ffff88802799b820 inflate_threshold=50 threshold=25 In tnode_resize ffff88804a67fc20 inflate_threshold=50 threshold=25 In tnode_resize ffff88802ddf8d20 inflate_threshold=50 threshold=25 In tnode_resize ffff8880374b4020 inflate_threshold=50 threshold=25 In tnode_resize ffff88805c4bd120 inflate_threshold=50 threshold=25 In tnode_resize ffff888058e53b20 inflate_threshold=50 threshold=25 trie_flush found=1 IPv6: walker ffffc9000376f1d8 adjusted by unlink of ffff888040238800 IPv6: walker ffffc9000376f1d8 adjusted by unlink of ffff888040238c00 IPv6: walker ffffc9000376f1d8 adjusted by unlink of ffff888040183c00 IPv6: walker ffffc9000376f1d8 adjusted by unlink of ffff8880347c3800 IPv6: fixing tree: plen=128 iter=0 IPv6: W ffffc9000376f1d8 adjusted by delnode 1, s=4/2 IPv6: fixing tree: plen=120 iter=1 IPv6: W ffffc9000376f1d8 adjusted by delnode 2, s=2 IPv6: fixing tree: plen=97 iter=2 IPv6: walker ffffc9000376f1d8 adjusted by unlink of ffff88804023bc00 IPv6: fixing tree: plen=128 iter=0 IPv6: W ffffc9000376f1d8 adjusted by delnode 1, s=4/2 IPv6: fixing tree: plen=120 iter=1 IPv6: W ffffc9000376f1d8 adjusted by delnode 2, s=2 IPv6: fixing tree: plen=70 iter=2 IPv6: walker ffffc9000376f1d8 adjusted by unlink of ffff888040239800 syz_tun: bond_netdev_event received NETDEV_DOWN net syz_tun: siw: event 2 Deleting ac141400/24 dsfield=0x00 t=ffff88805c461338 Deleting ac1414ff/32 dsfield=0x00 t=ffff88805c461338 Deleting ac1414aa/32 dsfield=0x00 t=ffff88805c461338 In tnode_resize ffff88802ddf8d20 inflate_threshold=50 threshold=25 In tnode_resize ffff888058e53b20 inflate_threshold=50 threshold=25 syz_tun (unregistering): bond_netdev_event received NETDEV_UNREGISTER net syz_tun: siw: event 6 syz_tun (unregistering): bond_netdev_event received NETDEV_PRE_UNINIT net syz_tun: siw: event 18 kernfs rps_cpus: removing kernfs rps_flow_cnt: removing kobject: 'rx-0' (ffff88803791c250): kobject_cleanup, parent ffff88804a515550 kobject: 'rx-0' (ffff88803791c250): auto cleanup kobject_del kobject: 'rx-0' (ffff88803791c250): auto cleanup 'remove' event kobject: 'rx-0' (ffff88803791c250): kobject_uevent_env kobject: 'rx-0' (ffff88803791c250): fill_kobj_path: path = '/devices/virtual/net/syz_tun/queues/rx-0' kernfs rx-0: removing kobject: 'rx-0' (ffff88803791c250): calling ktype release kobject: 'rx-0': free name kernfs tx_timeout: removing kernfs traffic_class: removing kernfs xps_cpus: removing kernfs xps_rxqs: removing kernfs tx_maxrate: removing kobject: 'tx-0' (ffff888036da5420): kobject_cleanup, parent ffff88804a515550 kobject: 'tx-0' (ffff888036da5420): auto cleanup kobject_del kobject: 'tx-0' (ffff888036da5420): auto cleanup 'remove' event kobject: 'tx-0' (ffff888036da5420): kobject_uevent_env kobject: 'tx-0' (ffff888036da5420): fill_kobj_path: path = '/devices/virtual/net/syz_tun/queues/tx-0' kernfs tx-0: removing kobject: 'tx-0' (ffff888036da5420): calling ktype release kobject: 'tx-0': free name kernfs queues: removing kobject: 'queues' (ffff88804a515550): kobject_cleanup, parent 0000000000000000 kobject: 'queues' (ffff88804a515550): calling ktype release kobject: 'queues' (ffff88804a515550): kset_release kobject: 'queues': 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 syz_tun: removing kernfs uevent: removing kernfs tun_flags: removing kernfs owner: removing kernfs group: removing kernfs rx_packets: removing kernfs tx_packets: removing kernfs rx_bytes: removing kernfs tx_bytes: removing kernfs rx_errors: removing kernfs tx_errors: removing kernfs rx_dropped: removing kernfs tx_dropped: removing kernfs multicast: removing kernfs collisions: removing kernfs rx_length_errors: removing kernfs rx_over_errors: removing kernfs rx_crc_errors: removing kernfs rx_frame_errors: removing kernfs rx_fifo_errors: removing kernfs rx_missed_errors: removing kernfs tx_aborted_errors: removing kernfs tx_carrier_errors: removing kernfs tx_fifo_errors: removing kernfs tx_heartbeat_errors: removing kernfs tx_window_errors: removing kernfs rx_compressed: removing kernfs tx_compressed: removing kernfs rx_nohandler: removing kernfs statistics: removing kernfs netdev_group: removing kernfs type: removing kernfs dev_id: removing kernfs dev_port: removing kernfs iflink: removing kernfs ifindex: removing kernfs name_assign_type: removing kernfs addr_assign_type: removing kernfs addr_len: removing kernfs link_mode: removing kernfs address: removing kernfs broadcast: removing kernfs speed: removing kernfs duplex: removing kernfs dormant: removing kernfs testing: removing kernfs operstate: removing kernfs carrier_changes: removing kernfs ifalias: removing kernfs carrier: removing kernfs mtu: removing kernfs flags: removing kernfs tx_queue_len: removing kernfs gro_flush_timeout: removing kernfs napi_defer_hard_irqs: removing kernfs proto_down: removing kernfs carrier_up_count: removing kernfs carrier_down_count: removing kernfs threaded: removing PM: Removing info for No Bus:syz_tun kobject: 'syz_tun' (ffff888036be07e0): kobject_uevent_env kobject: 'syz_tun' (ffff888036be07e0): fill_kobj_path: path = '/devices/virtual/net/syz_tun' kernfs syz_tun: removing kobject: 'syz_tun' (ffff888036be07e0): kobject_cleanup, parent 0000000000000000