[v5.15] possible deadlock in tcm_alloc

0 views
Skip to first unread message

syzbot

unread,
Aug 4, 2026, 2:59:45 PM (yesterday) Aug 4
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 6e2fd6534337 Linux 5.15.213
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10e9acc6580000
kernel config: https://syzkaller.appspot.com/x/.config?x=f161cbc9aef65db0
dashboard link: https://syzkaller.appspot.com/bug?extid=9acece748f6cbdfd437f
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/d7b46606b13d/disk-6e2fd653.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/da120fdeb081/vmlinux-6e2fd653.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3c2643457e3f/bzImage-6e2fd653.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9acece...@syzkaller.appspotmail.com

======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.23/4348 is trying to acquire lock:
ffffffff8cf21328 (tpg_instances_lock){+.+.}-{3:3}, at: tcm_alloc+0x1d/0x1e0 drivers/usb/gadget/function/f_tcm.c:2283

but task is already holding lock:
ffff888141dc2310 (&gi->lock){+.+.}-{3:3}, at: config_usb_cfg_link+0x55/0x250 drivers/usb/gadget/configfs.c:428

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&gi->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
config_usb_cfg_link+0x55/0x250 drivers/usb/gadget/configfs.c:428
configfs_symlink+0x5a4/0x13b0 fs/configfs/symlink.c:202
vfs_symlink+0x245/0x3d0 fs/namei.c:4437
do_symlinkat+0x1ab/0x6b0 fs/namei.c:4466
__do_sys_symlinkat fs/namei.c:4483 [inline]
__se_sys_symlinkat fs/namei.c:4480 [inline]
__x64_sys_symlinkat+0x95/0xa0 fs/namei.c:4480
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 (&sb->s_type->i_mutex_key#22){++++}-{3:3}:
down_write+0x38/0x60 kernel/locking/rwsem.c:1551
inode_lock include/linux/fs.h:787 [inline]
configfs_depend_item_unlocked+0x14f/0x430 fs/configfs/dir.c:1255
usbg_make_tpg+0x1f3/0x580 drivers/usb/gadget/function/f_tcm.c:1351
target_fabric_make_tpg+0xa0/0x6d0 drivers/target/target_core_fabric_configfs.c:837
configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1360
vfs_mkdir+0x386/0x570 fs/namei.c:4073
do_mkdirat+0x1dd/0x5c0 fs/namei.c:4098
__do_sys_mkdirat fs/namei.c:4113 [inline]
__se_sys_mkdirat fs/namei.c:4111 [inline]
__x64_sys_mkdirat+0x85/0x90 fs/namei.c:4111
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 (&opts->dep_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
usbg_make_tpg+0x144/0x580 drivers/usb/gadget/function/f_tcm.c:1343
target_fabric_make_tpg+0xa0/0x6d0 drivers/target/target_core_fabric_configfs.c:837
configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1360
vfs_mkdir+0x386/0x570 fs/namei.c:4073
do_mkdirat+0x1dd/0x5c0 fs/namei.c:4098
__do_sys_mkdirat fs/namei.c:4113 [inline]
__se_sys_mkdirat fs/namei.c:4111 [inline]
__x64_sys_mkdirat+0x85/0x90 fs/namei.c:4111
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 (tpg_instances_lock){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012
lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623
__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+0x1d/0x1e0 drivers/usb/gadget/function/f_tcm.c:2283
usb_get_function+0x59/0xa0 drivers/usb/gadget/functions.c:61
config_usb_cfg_link+0x144/0x250 drivers/usb/gadget/configfs.c:458
configfs_symlink+0x5a4/0x13b0 fs/configfs/symlink.c:202
vfs_symlink+0x245/0x3d0 fs/namei.c:4437
do_symlinkat+0x1ab/0x6b0 fs/namei.c:4466
__do_sys_symlinkat fs/namei.c:4483 [inline]
__se_sys_symlinkat fs/namei.c:4480 [inline]
__x64_sys_symlinkat+0x95/0xa0 fs/namei.c:4480
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:
tpg_instances_lock --> &sb->s_type->i_mutex_key#22 --> &gi->lock

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&gi->lock);
lock(&sb->s_type->i_mutex_key#22);
lock(&gi->lock);
lock(tpg_instances_lock);

*** DEADLOCK ***

3 locks held by syz.0.23/4348:
#0: ffff88801dd16460 (sb_writers#14){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:386
#1: ffff88805e210b70 (&sb->s_type->i_mutex_key#22){++++}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
#1: ffff88805e210b70 (&sb->s_type->i_mutex_key#22){++++}-{3:3}, at: configfs_symlink+0x47b/0x13b0 fs/configfs/symlink.c:192
#2: ffff888141dc2310 (&gi->lock){+.+.}-{3:3}, at: config_usb_cfg_link+0x55/0x250 drivers/usb/gadget/configfs.c:428

stack backtrace:
CPU: 1 PID: 4348 Comm: syz.0.23 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
<TASK>
dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106
check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2133
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012
lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623
__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+0x1d/0x1e0 drivers/usb/gadget/function/f_tcm.c:2283
usb_get_function+0x59/0xa0 drivers/usb/gadget/functions.c:61
config_usb_cfg_link+0x144/0x250 drivers/usb/gadget/configfs.c:458
configfs_symlink+0x5a4/0x13b0 fs/configfs/symlink.c:202
vfs_symlink+0x245/0x3d0 fs/namei.c:4437
do_symlinkat+0x1ab/0x6b0 fs/namei.c:4466
__do_sys_symlinkat fs/namei.c:4483 [inline]
__se_sys_symlinkat fs/namei.c:4480 [inline]
__x64_sys_symlinkat+0x95/0xa0 fs/namei.c:4480
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:0x7efd36ac9019
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:00007efd34d21028 EFLAGS: 00000246 ORIG_RAX: 000000000000010a
RAX: ffffffffffffffda RBX: 00007efd36d50fa0 RCX: 00007efd36ac9019
RDX: 0000200000000a40 RSI: ffffffffffffff9c RDI: 0000200000000a00
RBP: 00007efd36b6000c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007efd36d51038 R14: 00007efd36d50fa0 R15: 00007ffcff2db168
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Aug 4, 2026, 4:57:40 PM (yesterday) Aug 4
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: aa0e49877a2e Linux 6.6.148
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10f27e32580000
kernel config: https://syzkaller.appspot.com/x/.config?x=f0bc3d90c30838b5
dashboard link: https://syzkaller.appspot.com/bug?extid=ea06458b17a727d0decd
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/f83b390cfc1f/disk-aa0e4987.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1d4bdb338edd/vmlinux-aa0e4987.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3f57c1d51ee3/bzImage-aa0e4987.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+ea0645...@syzkaller.appspotmail.com

se_device not configured yet, cannot port link
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.1.6/5842 is trying to acquire lock:
ffffffff8de58f08 (tpg_instances_lock){+.+.}-{3:3}, at: tcm_alloc+0x21/0x1e0 drivers/usb/gadget/function/f_tcm.c:2247

but task is already holding lock:
ffff888021df8398 (&gi->lock){+.+.}-{3:3}, at: config_usb_cfg_link+0x59/0x250 drivers/usb/gadget/configfs.c:439

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&gi->lock){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747
config_usb_cfg_link+0x59/0x250 drivers/usb/gadget/configfs.c:439
configfs_symlink+0x5a5/0xfe0 fs/configfs/symlink.c:202
vfs_symlink+0x138/0x2b0 fs/namei.c:4528
do_symlinkat+0x1ba/0x400 fs/namei.c:4554
__do_sys_symlink fs/namei.c:4575 [inline]
__se_sys_symlink fs/namei.c:4573 [inline]
__x64_sys_symlink+0x7e/0x90 fs/namei.c:4573
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 (&sb->s_type->i_mutex_key#20){++++}-{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+0x1f7/0x580 drivers/usb/gadget/function/f_tcm.c:1341
target_fabric_make_tpg+0xa4/0x6d0 drivers/target/target_core_fabric_configfs.c:939
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 (&opts->dep_lock){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747
usbg_make_tpg+0x148/0x580 drivers/usb/gadget/function/f_tcm.c:1333
target_fabric_make_tpg+0xa4/0x6d0 drivers/target/target_core_fabric_configfs.c:939
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

-> #0 (tpg_instances_lock){+.+.}-{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:5754
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747
tcm_alloc+0x21/0x1e0 drivers/usb/gadget/function/f_tcm.c:2247
usb_get_function+0x5d/0xb0 drivers/usb/gadget/functions.c:61
config_usb_cfg_link+0x148/0x250 drivers/usb/gadget/configfs.c:469
configfs_symlink+0x5a5/0xfe0 fs/configfs/symlink.c:202
vfs_symlink+0x138/0x2b0 fs/namei.c:4528
do_symlinkat+0x1ba/0x400 fs/namei.c:4554
__do_sys_symlink fs/namei.c:4575 [inline]
__se_sys_symlink fs/namei.c:4573 [inline]
__x64_sys_symlink+0x7e/0x90 fs/namei.c:4573
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:
tpg_instances_lock --> &sb->s_type->i_mutex_key#20 --> &gi->lock

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&gi->lock);
lock(&sb->s_type->i_mutex_key#20);
lock(&gi->lock);
lock(tpg_instances_lock);

*** DEADLOCK ***

3 locks held by syz.1.6/5842:
#0: ffff888018f1c418 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:412
#1: ffff88805e0dcb80 (&sb->s_type->i_mutex_key#20){++++}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
#1: ffff88805e0dcb80 (&sb->s_type->i_mutex_key#20){++++}-{3:3}, at: configfs_symlink+0x47a/0xfe0 fs/configfs/symlink.c:192
#2: ffff888021df8398 (&gi->lock){+.+.}-{3:3}, at: config_usb_cfg_link+0x59/0x250 drivers/usb/gadget/configfs.c:439

stack backtrace:
CPU: 0 PID: 5842 Comm: syz.1.6 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
<TASK>
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:5754
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747
tcm_alloc+0x21/0x1e0 drivers/usb/gadget/function/f_tcm.c:2247
usb_get_function+0x5d/0xb0 drivers/usb/gadget/functions.c:61
config_usb_cfg_link+0x148/0x250 drivers/usb/gadget/configfs.c:469
configfs_symlink+0x5a5/0xfe0 fs/configfs/symlink.c:202
vfs_symlink+0x138/0x2b0 fs/namei.c:4528
do_symlinkat+0x1ba/0x400 fs/namei.c:4554
__do_sys_symlink fs/namei.c:4575 [inline]
__se_sys_symlink fs/namei.c:4573 [inline]
__x64_sys_symlink+0x7e/0x90 fs/namei.c:4573
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:0x7f234b59e019
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:00007f234c3e1028 EFLAGS: 00000246 ORIG_RAX: 0000000000000058
RAX: ffffffffffffffda RBX: 00007f234b825fa0 RCX: 00007f234b59e019
RDX: 0000000000000000 RSI: 0000200000000a40 RDI: 0000200000000a00
RBP: 00007f234b63500c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f234b826038 R14: 00007f234b825fa0 R15: 00007ffc3239ef78

syzbot

unread,
Aug 4, 2026, 5:00:39 PM (yesterday) Aug 4
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: fb28aa725e05 Linux 6.1.180
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=179f13b9580000
kernel config: https://syzkaller.appspot.com/x/.config?x=872c04466179833f
dashboard link: https://syzkaller.appspot.com/bug?extid=71529afa64b23e366568
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8
userspace arch: arm64

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/d420eb944682/disk-fb28aa72.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/affae450ab23/vmlinux-fb28aa72.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b9e6919ed519/Image-fb28aa72.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+71529a...@syzkaller.appspotmail.com

======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.2.16/4450 is trying to acquire lock:
ffff800016f71c28 (tpg_instances_lock){+.+.}-{3:3}, at: tcm_alloc+0x2c/0x200 drivers/usb/gadget/function/f_tcm.c:2278

but task is already holding lock:
ffff00011ff81310 (&gi->lock){+.+.}-{3:3}, at: config_usb_cfg_link+0x5c/0x22c drivers/usb/gadget/configfs.c:429

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&gi->lock){+.+.}-{3:3}:
__mutex_lock_common+0x1a0/0x1f3c kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
config_usb_cfg_link+0x5c/0x22c drivers/usb/gadget/configfs.c:429
configfs_symlink+0x468/0xee0 fs/configfs/symlink.c:202
vfs_symlink+0x238/0x3b0 fs/namei.c:4479
do_symlinkat+0x178/0x35c fs/namei.c:4508
__do_sys_symlinkat fs/namei.c:4525 [inline]
__se_sys_symlinkat fs/namei.c:4522 [inline]
__arm64_sys_symlinkat+0xa4/0xbc fs/namei.c:4522
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x290 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x5c/0x134 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #2 (&sb->s_type->i_mutex_key#20){++++}-{3:3}:
down_write+0x5c/0x88 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:758 [inline]
configfs_depend_item_unlocked+0x128/0x41c fs/configfs/dir.c:1255
usbg_make_tpg+0x1d0/0x4cc drivers/usb/gadget/function/f_tcm.c:1365
target_fabric_make_tpg+0x98/0x518 drivers/target/target_core_fabric_configfs.c:905
configfs_mkdir+0x3e0/0x884 fs/configfs/dir.c:1360
vfs_mkdir+0x314/0x4d8 fs/namei.c:4114
do_mkdirat+0x1b8/0x3ec fs/namei.c:4139
__do_sys_mkdirat fs/namei.c:4154 [inline]
__se_sys_mkdirat fs/namei.c:4152 [inline]
__arm64_sys_mkdirat+0x90/0xa8 fs/namei.c:4152
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x290 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x5c/0x134 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #1 (&opts->dep_lock){+.+.}-{3:3}:
__mutex_lock_common+0x1a0/0x1f3c kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
usbg_make_tpg+0x140/0x4cc drivers/usb/gadget/function/f_tcm.c:1357
target_fabric_make_tpg+0x98/0x518 drivers/target/target_core_fabric_configfs.c:905
configfs_mkdir+0x3e0/0x884 fs/configfs/dir.c:1360
vfs_mkdir+0x314/0x4d8 fs/namei.c:4114
do_mkdirat+0x1b8/0x3ec fs/namei.c:4139
__do_sys_mkdirat fs/namei.c:4154 [inline]
__se_sys_mkdirat fs/namei.c:4152 [inline]
__arm64_sys_mkdirat+0x90/0xa8 fs/namei.c:4152
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x290 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x5c/0x134 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #0 (tpg_instances_lock){+.+.}-{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+0x2808/0x6634 kernel/locking/lockdep.c:5063
lock_acquire+0x20c/0x638 kernel/locking/lockdep.c:5676
__mutex_lock_common+0x1a0/0x1f3c kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
tcm_alloc+0x2c/0x200 drivers/usb/gadget/function/f_tcm.c:2278
usb_get_function+0x64/0xb0 drivers/usb/gadget/functions.c:61
config_usb_cfg_link+0x13c/0x22c drivers/usb/gadget/configfs.c:459
configfs_symlink+0x468/0xee0 fs/configfs/symlink.c:202
vfs_symlink+0x238/0x3b0 fs/namei.c:4479
do_symlinkat+0x178/0x35c fs/namei.c:4508
__do_sys_symlinkat fs/namei.c:4525 [inline]
__se_sys_symlinkat fs/namei.c:4522 [inline]
__arm64_sys_symlinkat+0xa4/0xbc fs/namei.c:4522
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x290 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x5c/0x134 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

other info that might help us debug this:

Chain exists of:
tpg_instances_lock --> &sb->s_type->i_mutex_key#20 --> &gi->lock

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&gi->lock);
lock(&sb->s_type->i_mutex_key#20);
lock(&gi->lock);
lock(tpg_instances_lock);

*** DEADLOCK ***

3 locks held by syz.2.16/4450:
#0: ffff0000c70a8460 (sb_writers#12){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:402
#1: ffff0000dff2f900 (&sb->s_type->i_mutex_key#20){++++}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
#1: ffff0000dff2f900 (&sb->s_type->i_mutex_key#20){++++}-{3:3}, at: configfs_symlink+0x310/0xee0 fs/configfs/symlink.c:192
#2: ffff00011ff81310 (&gi->lock){+.+.}-{3:3}, at: config_usb_cfg_link+0x5c/0x22c drivers/usb/gadget/configfs.c:429

stack backtrace:
CPU: 0 PID: 4450 Comm: syz.2.16 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/02/2026
Call trace:
dump_backtrace+0x1c4/0x1f0 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack+0x30/0x40 lib/dump_stack.c:88
dump_stack_lvl+0xf4/0x15c lib/dump_stack.c:106
dump_stack+0x1c/0x5c lib/dump_stack.c:113
print_circular_bug+0x148/0x1b0 kernel/locking/lockdep.c:2048
check_noncircular+0x264/0x2f8 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+0x2808/0x6634 kernel/locking/lockdep.c:5063
lock_acquire+0x20c/0x638 kernel/locking/lockdep.c:5676
__mutex_lock_common+0x1a0/0x1f3c kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
tcm_alloc+0x2c/0x200 drivers/usb/gadget/function/f_tcm.c:2278
usb_get_function+0x64/0xb0 drivers/usb/gadget/functions.c:61
config_usb_cfg_link+0x13c/0x22c drivers/usb/gadget/configfs.c:459
configfs_symlink+0x468/0xee0 fs/configfs/symlink.c:202
vfs_symlink+0x238/0x3b0 fs/namei.c:4479
do_symlinkat+0x178/0x35c fs/namei.c:4508
__do_sys_symlinkat fs/namei.c:4525 [inline]
__se_sys_symlinkat fs/namei.c:4522 [inline]
__arm64_sys_symlinkat+0xa4/0xbc fs/namei.c:4522
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x290 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x13c/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x5c/0x134 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
UDC core: g1: couldn't find an available UDC or it's busy
Reply all
Reply to author
Forward
0 new messages