possible deadlock in configfs_depend_item_unlocked

Status: upstream: reported on 2026/07/25 08:24
Reported-by: syzbot+b352a6b36d7559581922@syzkaller.appspotmail.com
First crash: 1d08h, last: 1d05h
Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.6 possible deadlock in configfs_depend_item_unlocked 4 5 9h02m 1d04h 0/2 upstream: reported on 2026/07/25 12:59
linux-5.15 possible deadlock in configfs_depend_item_unlocked 4 7 22h14m 1d10h 0/3 upstream: reported on 2026/07/25 06:55

Sample crash report:
Rounding down aligned max_sectors from 4294967295 to 4294967288
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.9.640/7806 is trying to acquire lock:
ffff888148d4b3f0 (&sb->s_type->i_mutex_key#21){++++}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
ffff888148d4b3f0 (&sb->s_type->i_mutex_key#21){++++}-{3:3}, at: configfs_depend_item_unlocked+0x14f/0x430 fs/configfs/dir.c:1255

but task is already holding lock:
ffff8880552e0120 (&opts->dep_lock){+.+.}-{3:3}, at: usbg_make_tpg+0x144/0x580 drivers/usb/gadget/function/f_tcm.c:1357

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+0x12d/0xae0 kernel/locking/mutex.c:747
       tcm_set_name+0x26/0x90 drivers/usb/gadget/function/f_tcm.c:2219
       function_make+0x195/0x350 drivers/usb/gadget/configfs.c:625
       configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1360
       vfs_mkdir+0x386/0x570 fs/namei.c:4114
       do_mkdirat+0x1d8/0x440 fs/namei.c:4139
       __do_sys_mkdir fs/namei.c:4159 [inline]
       __se_sys_mkdir fs/namei.c:4157 [inline]
       __x64_sys_mkdir+0x6a/0x80 fs/namei.c:4157
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x4c/0xa0 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+0x12d/0xae0 kernel/locking/mutex.c:747
       configfs_rmdir+0x638/0x980 fs/configfs/dir.c:1556
       vfs_rmdir+0x34e/0x4a0 fs/namei.c:4199
       do_rmdir+0x29a/0x5c0 fs/namei.c:4260
       __do_sys_rmdir fs/namei.c:4279 [inline]
       __se_sys_rmdir fs/namei.c:4277 [inline]
       __x64_sys_rmdir+0x45/0x50 fs/namei.c:4277
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&sb->s_type->i_mutex_key#21){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3095 [inline]
       check_prevs_add kernel/locking/lockdep.c:3214 [inline]
       validate_chain kernel/locking/lockdep.c:3830 [inline]
       __lock_acquire+0x2d18/0x7c40 kernel/locking/lockdep.c:5063
       lock_acquire+0x1bb/0x4a0 kernel/locking/lockdep.c:5676
       down_write+0x36/0x60 kernel/locking/rwsem.c:1573
       inode_lock include/linux/fs.h:758 [inline]
       configfs_depend_item_unlocked+0x14f/0x430 fs/configfs/dir.c:1255
       usbg_make_tpg+0x1f3/0x580 drivers/usb/gadget/function/f_tcm.c:1365
       target_fabric_make_tpg+0xa0/0x6d0 drivers/target/target_core_fabric_configfs.c:905
       configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1360
       vfs_mkdir+0x386/0x570 fs/namei.c:4114
       do_mkdirat+0x1d8/0x440 fs/namei.c:4139
       __do_sys_mkdirat fs/namei.c:4154 [inline]
       __se_sys_mkdirat fs/namei.c:4152 [inline]
       __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4152
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x4c/0xa0 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#21 --> gadget_subsys.su_mutex --> &opts->dep_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&opts->dep_lock);
                               lock(gadget_subsys.su_mutex);
                               lock(&opts->dep_lock);
  lock(&sb->s_type->i_mutex_key#21);

 *** DEADLOCK ***

5 locks held by syz.9.640/7806:
 #0: ffff888145eee460 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:402
 #1: ffff8880783c0150 (&sb->s_type->i_mutex_key#7/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:793 [inline]
 #1: ffff8880783c0150 (&sb->s_type->i_mutex_key#7/1){+.+.}-{3:3}, at: filename_create+0x20b/0x450 fs/namei.c:3884
 #2: ffffffff8d4e96b0 (&subsys->su_mutex){+.+.}-{3:3}, at: configfs_mkdir+0x4b5/0x9e0 fs/configfs/dir.c:1358
 #3: ffffffff8d8089e8 (tpg_instances_lock){+.+.}-{3:3}, at: usbg_make_tpg+0xf4/0x580 drivers/usb/gadget/function/f_tcm.c:1348
 #4: ffff8880552e0120 (&opts->dep_lock){+.+.}-{3:3}, at: usbg_make_tpg+0x144/0x580 drivers/usb/gadget/function/f_tcm.c:1357

stack backtrace:
CPU: 1 PID: 7806 Comm: syz.9.640 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
 check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3095 [inline]
 check_prevs_add kernel/locking/lockdep.c:3214 [inline]
 validate_chain kernel/locking/lockdep.c:3830 [inline]
 __lock_acquire+0x2d18/0x7c40 kernel/locking/lockdep.c:5063
 lock_acquire+0x1bb/0x4a0 kernel/locking/lockdep.c:5676
 down_write+0x36/0x60 kernel/locking/rwsem.c:1573
 inode_lock include/linux/fs.h:758 [inline]
 configfs_depend_item_unlocked+0x14f/0x430 fs/configfs/dir.c:1255
 usbg_make_tpg+0x1f3/0x580 drivers/usb/gadget/function/f_tcm.c:1365
 target_fabric_make_tpg+0xa0/0x6d0 drivers/target/target_core_fabric_configfs.c:905
 configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1360
 vfs_mkdir+0x386/0x570 fs/namei.c:4114
 do_mkdirat+0x1d8/0x440 fs/namei.c:4139
 __do_sys_mkdirat fs/namei.c:4154 [inline]
 __se_sys_mkdirat fs/namei.c:4152 [inline]
 __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4152
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f331d19de99
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:00007f331e0b2028 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007f331d425fa0 RCX: 00007f331d19de99
RDX: 00000000000001ff RSI: 0000200000001000 RDI: ffffffffffffff9c
RBP: 00007f331d233eaf R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f331d426038 R14: 00007f331d425fa0 R15: 00007ffc8f01c0e8
 </TASK>

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/07/25 12:03 linux-6.1.y dc5c83b7f5f8 492bab15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in configfs_depend_item_unlocked
2026/07/25 12:03 linux-6.1.y dc5c83b7f5f8 492bab15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in configfs_depend_item_unlocked
2026/07/25 11:59 linux-6.1.y dc5c83b7f5f8 492bab15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in configfs_depend_item_unlocked
2026/07/25 11:59 linux-6.1.y dc5c83b7f5f8 492bab15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in configfs_depend_item_unlocked
2026/07/25 08:59 linux-6.1.y dc5c83b7f5f8 492bab15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in configfs_depend_item_unlocked
2026/07/25 08:23 linux-6.1.y dc5c83b7f5f8 492bab15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in configfs_depend_item_unlocked
* Struck through repros no longer work on HEAD.