[v5.15] possible deadlock in configfs_depend_item_unlocked

0 views
Skip to first unread message

syzbot

unread,
Jul 25, 2026, 2:55:39 AM (yesterday) Jul 25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 674f684f7c61 Linux 5.15.212
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12462449580000
kernel config: https://syzkaller.appspot.com/x/.config?x=f161cbc9aef65db0
dashboard link: https://syzkaller.appspot.com/bug?extid=f554b6422370e4e45878
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/f55be2937b89/disk-674f684f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a19fb0ffc049/vmlinux-674f684f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/365d4529a007/bzImage-674f684f.xz

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

db_root: cannot be changed: target drivers registered
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.4.187/5024 is trying to acquire lock:
ffff88801d3ea4c0 (&sb->s_type->i_mutex_key#25){++++}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
ffff88801d3ea4c0 (&sb->s_type->i_mutex_key#25){++++}-{3:3}, at: configfs_depend_item_unlocked+0x14f/0x430 fs/configfs/dir.c:1255

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

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+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_set_name+0x26/0x90 drivers/usb/gadget/function/f_tcm.c:2224
function_make+0x195/0x350 drivers/usb/gadget/configfs.c:620
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_mkdir fs/namei.c:4118 [inline]
__se_sys_mkdir fs/namei.c:4116 [inline]
__x64_sys_mkdir+0x6a/0x80 fs/namei.c:4116
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 (gadget_subsys.su_mutex){+.+.}-{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
configfs_rmdir+0x638/0x980 fs/configfs/dir.c:1556
vfs_rmdir+0x19d/0x410 fs/namei.c:4157
do_rmdir+0x27f/0x710 fs/namei.c:4218
__do_sys_rmdir fs/namei.c:4237 [inline]
__se_sys_rmdir fs/namei.c:4235 [inline]
__x64_sys_rmdir+0x45/0x50 fs/namei.c:4235
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 (&sb->s_type->i_mutex_key#25){++++}-{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
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_mkdir fs/namei.c:4118 [inline]
__se_sys_mkdir fs/namei.c:4116 [inline]
__x64_sys_mkdir+0x6a/0x80 fs/namei.c:4116
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:
&sb->s_type->i_mutex_key#25 --> 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#25);

*** DEADLOCK ***

5 locks held by syz.4.187/5024:
#0: ffff88801da80460 (sb_writers#17){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:386
#1: ffff88805d009fb0 (&sb->s_type->i_mutex_key#7/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:822 [inline]
#1: ffff88805d009fb0 (&sb->s_type->i_mutex_key#7/1){+.+.}-{3:3}, at: filename_create+0x20b/0x450 fs/namei.c:3843
#2: ffffffff8cc23e70 (&subsys->su_mutex){+.+.}-{3:3}, at: configfs_mkdir+0x4b5/0x9e0 fs/configfs/dir.c:1358
#3: ffffffff8cf21328 (tpg_instances_lock){+.+.}-{3:3}, at: usbg_make_tpg+0xf4/0x580 drivers/usb/gadget/function/f_tcm.c:1334
#4: ffff888078fa8120 (&opts->dep_lock){+.+.}-{3:3}, at: usbg_make_tpg+0x144/0x580 drivers/usb/gadget/function/f_tcm.c:1343

stack backtrace:
CPU: 1 PID: 5024 Comm: syz.4.187 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/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
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_mkdir fs/namei.c:4118 [inline]
__se_sys_mkdir fs/namei.c:4116 [inline]
__x64_sys_mkdir+0x6a/0x80 fs/namei.c:4116
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:0x7f97b4a8ee99
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:00007f97b2ce7028 EFLAGS: 00000246 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 00007f97b4d16fa0 RCX: 00007f97b4a8ee99
RDX: 0000000000000000 RSI: 00000000000001ff RDI: 0000200000000c00
RBP: 00007f97b4b24eaf R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f97b4d17038 R14: 00007f97b4d16fa0 R15: 00007ffc55f5f878
</TASK>
se_device not configured yet, cannot port link


---
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,
Jul 25, 2026, 4:24:30 AM (23 hours ago) Jul 25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: dc5c83b7f5f8 Linux 6.1.178
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13b8e1b9580000
kernel config: https://syzkaller.appspot.com/x/.config?x=872c04466179833f
dashboard link: https://syzkaller.appspot.com/bug?extid=b352a6b36d7559581922
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/96393e4697a3/disk-dc5c83b7.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/0d4afce44fab/vmlinux-dc5c83b7.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4787e310d875/Image-dc5c83b7.gz.xz

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

======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.1083/7511 is trying to acquire lock:
ffff0000c70229d0 (&sb->s_type->i_mutex_key#27){++++}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
ffff0000c70229d0 (&sb->s_type->i_mutex_key#27){++++}-{3:3}, at: configfs_depend_item_unlocked+0x128/0x41c fs/configfs/dir.c:1255

but task is already holding lock:
ffff0000f46f3520 (&opts->dep_lock){+.+.}-{3:3}, at: usbg_make_tpg+0x140/0x4cc 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+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_set_name+0x30/0xa4 drivers/usb/gadget/function/f_tcm.c:2219
function_make+0x184/0x2f8 drivers/usb/gadget/configfs.c:625
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 (gadget_subsys.su_mutex){+.+.}-{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
configfs_rmdir+0x564/0x850 fs/configfs/dir.c:1556
vfs_rmdir+0x304/0x438 fs/namei.c:4199
do_rmdir+0x244/0x524 fs/namei.c:4260
__do_sys_unlinkat fs/namei.c:4440 [inline]
__se_sys_unlinkat fs/namei.c:4434 [inline]
__arm64_sys_unlinkat+0xcc/0xfc fs/namei.c:4434
__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 (&sb->s_type->i_mutex_key#27){++++}-{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
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

other info that might help us debug this:

Chain exists of:
&sb->s_type->i_mutex_key#27 --> 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#27);

*** DEADLOCK ***

5 locks held by syz.0.1083/7511:
#0: ffff0000c6c6c460 (sb_writers#22){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:402
#1: ffff0000f4e11fb0 (&sb->s_type->i_mutex_key#7/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:793 [inline]
#1: ffff0000f4e11fb0 (&sb->s_type->i_mutex_key#7/1){+.+.}-{3:3}, at: filename_create+0x1b0/0x3a8 fs/namei.c:3884
#2: ffff800016b0b790 (&subsys->su_mutex){+.+.}-{3:3}, at: configfs_mkdir+0x3a0/0x884 fs/configfs/dir.c:1358
#3: ffff800016f71c28 (tpg_instances_lock){+.+.}-{3:3}, at: usbg_make_tpg+0x100/0x4cc drivers/usb/gadget/function/f_tcm.c:1348
#4: ffff0000f46f3520 (&opts->dep_lock){+.+.}-{3:3}, at: usbg_make_tpg+0x140/0x4cc drivers/usb/gadget/function/f_tcm.c:1357

stack backtrace:
CPU: 1 PID: 7511 Comm: syz.0.1083 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
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

syzbot

unread,
Jul 25, 2026, 8:59:37 AM (18 hours ago) Jul 25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: c5596480c50e Linux 6.6.145
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1284dfde580000
kernel config: https://syzkaller.appspot.com/x/.config?x=f0bc3d90c30838b5
dashboard link: https://syzkaller.appspot.com/bug?extid=35c6202df82fb8c32975
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/eb5cda0a8020/disk-c5596480.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ca05ff2fc502/vmlinux-c5596480.xz
kernel image: https://storage.googleapis.com/syzbot-assets/6daf3255b985/bzImage-c5596480.xz

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

======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.4.2473/15458 is trying to acquire lock:
ffff888020110670 (&sb->s_type->i_mutex_key#22){++++}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
ffff888020110670 (&sb->s_type->i_mutex_key#22){++++}-{3:3}, at: configfs_depend_item_unlocked+0x157/0x430 fs/configfs/dir.c:1255

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

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+0x135/0xc80 kernel/locking/mutex.c:747
tcm_set_name+0x2a/0x90 drivers/usb/gadget/function/f_tcm.c:2188
function_make+0x199/0x350 drivers/usb/gadget/configfs.c:635
configfs_mkdir+0x515/0x9e0 fs/configfs/dir.c:1360
vfs_mkdir+0x2a5/0x470 fs/namei.c:4125
do_mkdirat+0x1dc/0x450 fs/namei.c:4148
__do_sys_mkdir fs/namei.c:4168 [inline]
__se_sys_mkdir fs/namei.c:4166 [inline]
__x64_sys_mkdir+0x6e/0x80 fs/namei.c:4166
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
configfs_rmdir+0x63c/0x980 fs/configfs/dir.c:1556
vfs_rmdir+0x352/0x4b0 fs/namei.c:4208
do_rmdir+0x29f/0x590 fs/namei.c:4267
__do_sys_rmdir fs/namei.c:4286 [inline]
__se_sys_rmdir fs/namei.c:4284 [inline]
__x64_sys_rmdir+0x49/0x50 fs/namei.c:4284
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 (&sb->s_type->i_mutex_key#22){++++}-{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
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:4125
do_mkdirat+0x1dc/0x450 fs/namei.c:4148
__do_sys_mkdir fs/namei.c:4168 [inline]
__se_sys_mkdir fs/namei.c:4166 [inline]
__x64_sys_mkdir+0x6e/0x80 fs/namei.c:4166
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:
&sb->s_type->i_mutex_key#22 --> 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#22);

*** DEADLOCK ***

5 locks held by syz.4.2473/15458:
#0: ffff88801f69c418 (sb_writers#17){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:412
#1: ffff888079561fc0 (&sb->s_type->i_mutex_key#7/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:839 [inline]
#1: ffff888079561fc0 (&sb->s_type->i_mutex_key#7/1){+.+.}-{3:3}, at: filename_create+0x20f/0x450 fs/namei.c:3894
#2: ffffffff8db2b450 (&subsys->su_mutex){+.+.}-{3:3}, at: configfs_mkdir+0x4b9/0x9e0 fs/configfs/dir.c:1358
#3: ffffffff8de58aa8 (tpg_instances_lock){+.+.}-{3:3}, at: usbg_make_tpg+0xf8/0x580 drivers/usb/gadget/function/f_tcm.c:1324
#4: ffff8880227b0520 (&opts->dep_lock){+.+.}-{3:3}, at: usbg_make_tpg+0x148/0x580 drivers/usb/gadget/function/f_tcm.c:1333

stack backtrace:
CPU: 1 PID: 15458 Comm: syz.4.2473 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/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
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:4125
do_mkdirat+0x1dc/0x450 fs/namei.c:4148
__do_sys_mkdir fs/namei.c:4168 [inline]
__se_sys_mkdir fs/namei.c:4166 [inline]
__x64_sys_mkdir+0x6e/0x80 fs/namei.c:4166
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:0x7fa7db39de99
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:00007fa7dc262028 EFLAGS: 00000246 ORIG_RAX: 0000000000000053
RAX: ffffffffffffffda RBX: 00007fa7db625fa0 RCX: 00007fa7db39de99
RDX: 0000000000000000 RSI: 00000000000001ff RDI: 0000200000000c00
RBP: 00007fa7db433eaf R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fa7db626038 R14: 00007fa7db625fa0 R15: 00007fffe4c2d8b8
</TASK>
Reply all
Reply to author
Forward
0 new messages