Hello,
syzbot found the following issue on:
HEAD commit: 1a8763b93150 Linux 6.1.188
git tree: linux-6.1.y
console output:
https://syzkaller.appspot.com/x/log.txt?x=144f4df9580000
kernel config:
https://syzkaller.appspot.com/x/.config?x=31dfefc4a14efea3
dashboard link:
https://syzkaller.appspot.com/bug?extid=d1e0c27795157f3a0a50
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/be5de8c5e41e/disk-1a8763b9.raw.xz
vmlinux:
https://storage.googleapis.com/syzbot-assets/b803e8d05dd4/vmlinux-1a8763b9.xz
kernel image:
https://storage.googleapis.com/syzbot-assets/723f53728c4f/bzImage-1a8763b9.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by:
syzbot+d1e0c2...@syzkaller.appspotmail.com
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.1.708/7571 is trying to acquire lock:
ffffffff8d7b02b0 (gadget_subsys.su_mutex){+.+.}-{3:3}, at: uvcg_format_bma_controls_show drivers/usb/gadget/function/uvc_configfs.c:815 [inline]
ffffffff8d7b02b0 (gadget_subsys.su_mutex){+.+.}-{3:3}, at: uvcg_mjpeg_bma_controls_show+0x49/0x130 drivers/usb/gadget/function/uvc_configfs.c:1769
but task is already holding lock:
ffff88802883a478 (&p->frag_sem){++++}-{3:3}, at: fill_read_buffer fs/configfs/file.c:66 [inline]
ffff88802883a478 (&p->frag_sem){++++}-{3:3}, at: configfs_read_iter+0x19e/0x560 fs/configfs/file.c:88
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #4 (&p->frag_sem){++++}-{3:3}:
down_write_killable+0x45/0x90 kernel/locking/rwsem.c:1584
configfs_rmdir+0x3e0/0x980 fs/configfs/dir.c:1534
vfs_rmdir+0x34e/0x4a0 fs/namei.c:4242
do_rmdir+0x29a/0x5c0 fs/namei.c:4303
__do_sys_unlinkat fs/namei.c:4483 [inline]
__se_sys_unlinkat fs/namei.c:4477 [inline]
__x64_sys_unlinkat+0xc0/0xe0 fs/namei.c:4477
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
-> #3 (&sb->s_type->i_mutex_key#25){++++}-{3:3}:
down_write+0x36/0x60 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:764 [inline]
configfs_depend_item_unlocked+0x14f/0x430 fs/configfs/dir.c:1255
usbg_make_tpg+0x1dd/0x550 drivers/usb/gadget/function/f_tcm.c:1371
target_fabric_make_tpg+0xa0/0x6d0 drivers/target/target_core_fabric_configfs.c:913
configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1360
vfs_mkdir+0x386/0x570 fs/namei.c:4157
do_mkdirat+0x1d8/0x440 fs/namei.c:4182
__do_sys_mkdir fs/namei.c:4202 [inline]
__se_sys_mkdir fs/namei.c:4200 [inline]
__x64_sys_mkdir+0x6a/0x80 fs/namei.c:4200
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
-> #2 (tpg_instances_lock){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747
tcm_alloc_inst+0x61/0x190 drivers/usb/gadget/function/f_tcm.c:2366
try_get_usb_function_instance drivers/usb/gadget/functions.c:28 [inline]
usb_get_function_instance+0xd9/0x2e0 drivers/usb/gadget/functions.c:44
function_make+0x118/0x350 drivers/usb/gadget/configfs.c:615
configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1360
vfs_mkdir+0x386/0x570 fs/namei.c:4157
do_mkdirat+0x1d8/0x440 fs/namei.c:4182
__do_sys_mkdir fs/namei.c:4202 [inline]
__se_sys_mkdir fs/namei.c:4200 [inline]
__x64_sys_mkdir+0x6a/0x80 fs/namei.c:4200
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 (func_lock){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747
try_get_usb_function_instance drivers/usb/gadget/functions.c:18 [inline]
usb_get_function_instance+0x2a/0x2e0 drivers/usb/gadget/functions.c:44
function_make+0x118/0x350 drivers/usb/gadget/configfs.c:615
configfs_mkdir+0x511/0x9e0 fs/configfs/dir.c:1360
vfs_mkdir+0x386/0x570 fs/namei.c:4157
do_mkdirat+0x1d8/0x440 fs/namei.c:4182
__do_sys_mkdir fs/namei.c:4202 [inline]
__se_sys_mkdir fs/namei.c:4200 [inline]
__x64_sys_mkdir+0x6a/0x80 fs/namei.c:4200
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 (gadget_subsys.su_mutex){+.+.}-{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:5678
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747
uvcg_format_bma_controls_show drivers/usb/gadget/function/uvc_configfs.c:815 [inline]
uvcg_mjpeg_bma_controls_show+0x49/0x130 drivers/usb/gadget/function/uvc_configfs.c:1769
fill_read_buffer fs/configfs/file.c:68 [inline]
configfs_read_iter+0x296/0x560 fs/configfs/file.c:88
__kernel_read+0x2dd/0x6e0 fs/read_write.c:428
integrity_kernel_read+0x86/0xd0 security/integrity/iint.c:228
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline]
ima_calc_file_hash+0xb12/0x1950 security/integrity/ima/ima_crypto.c:573
ima_collect_measurement+0x503/0xb50 security/integrity/ima/ima_api.c:293
process_measurement+0x119b/0x1c40 security/integrity/ima/ima_main.c:351
ima_file_check+0xc8/0x110 security/integrity/ima/ima_main.c:534
do_open fs/namei.c:3679 [inline]
path_openat+0x272b/0x2f10 fs/namei.c:3834
do_filp_open+0x1ee/0x420 fs/namei.c:3861
do_sys_openat2+0x14b/0x4f0 fs/open.c:1320
do_sys_open fs/open.c:1336 [inline]
__do_sys_openat fs/open.c:1352 [inline]
__se_sys_openat fs/open.c:1347 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1347
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:
gadget_subsys.su_mutex --> &sb->s_type->i_mutex_key#25 --> &p->frag_sem
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&p->frag_sem);
lock(&sb->s_type->i_mutex_key#25);
lock(&p->frag_sem);
lock(gadget_subsys.su_mutex);
*** DEADLOCK ***
3 locks held by syz.1.708/7571:
#0: ffff888026b0a2d0 (&iint_mutex_key[depth]){+.+.}-{3:3}, at: process_measurement+0x717/0x1c40 security/integrity/ima/ima_main.c:261
#1: ffff88804244d888 (&buffer->mutex){+.+.}-{3:3}, at: configfs_read_iter+0x6e/0x560 fs/configfs/file.c:86
#2: ffff88802883a478 (&p->frag_sem){++++}-{3:3}, at: fill_read_buffer fs/configfs/file.c:66 [inline]
#2: ffff88802883a478 (&p->frag_sem){++++}-{3:3}, at: configfs_read_iter+0x19e/0x560 fs/configfs/file.c:88
stack backtrace:
CPU: 0 PID: 7571 Comm: syz.1.708 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/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:5678
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x12d/0xae0 kernel/locking/mutex.c:747
uvcg_format_bma_controls_show drivers/usb/gadget/function/uvc_configfs.c:815 [inline]
uvcg_mjpeg_bma_controls_show+0x49/0x130 drivers/usb/gadget/function/uvc_configfs.c:1769
fill_read_buffer fs/configfs/file.c:68 [inline]
configfs_read_iter+0x296/0x560 fs/configfs/file.c:88
__kernel_read+0x2dd/0x6e0 fs/read_write.c:428
integrity_kernel_read+0x86/0xd0 security/integrity/iint.c:228
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline]
ima_calc_file_hash+0xb12/0x1950 security/integrity/ima/ima_crypto.c:573
ima_collect_measurement+0x503/0xb50 security/integrity/ima/ima_api.c:293
process_measurement+0x119b/0x1c40 security/integrity/ima/ima_main.c:351
ima_file_check+0xc8/0x110 security/integrity/ima/ima_main.c:534
do_open fs/namei.c:3679 [inline]
path_openat+0x272b/0x2f10 fs/namei.c:3834
do_filp_open+0x1ee/0x420 fs/namei.c:3861
do_sys_openat2+0x14b/0x4f0 fs/open.c:1320
do_sys_open fs/open.c:1336 [inline]
__do_sys_openat fs/open.c:1352 [inline]
__se_sys_openat fs/open.c:1347 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1347
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:0x7f8033d9e159
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:00007f8034d43028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f8034025fa0 RCX: 00007f8033d9e159
RDX: 0000000000000002 RSI: 00002000000002c0 RDI: ffffffffffffff9c
RBP: 00007f8033e3506b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f8034026038 R14: 00007f8034025fa0 R15: 00007ffc8a2a9aa8
</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