* [syzbot] [input?] INFO: trying to register non-static key in roccat_open
@ 2026-09-06 2:07 syzbot
2026-09-07 22:44 ` [PATCH] HID: roccat: fully initialize device before publishing to devices[] Ivy Lopez
0 siblings, 1 reply; 2+ messages in thread
From: syzbot @ 2026-09-06 2:07 UTC (permalink / raw)
To: bentiss, erazor_de, jikos, linux-input, linux-kernel, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: bc35965f6940 Merge tag 'mm-hotfixes-stable-2026-09-03-17-4..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1066ab49580000
kernel config: https://syzkaller.appspot.com/x/.config?x=b454dc6b1b7acd30
dashboard link: https://syzkaller.appspot.com/bug?extid=9f7405999979761b6cfc
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/8cbf7acceedb/disk-bc35965f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/203c0c282c1c/vmlinux-bc35965f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/de1170205619/bzImage-bc35965f.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9f7405999979761b6cfc@syzkaller.appspotmail.com
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 1 UID: 0 PID: 7946 Comm: syz.4.562 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
assign_lock_key+0x133/0x150 kernel/locking/lockdep.c:1000
register_lock_class+0xcc/0x2e0 kernel/locking/lockdep.c:1315
__lock_acquire+0xaf/0x2e40 kernel/locking/lockdep.c:5128
lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5908
__mutex_lock_common kernel/locking/rtmutex_api.c:559 [inline]
mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:578
roccat_open+0xf6/0x5d0 drivers/hid/hid-roccat.c:178
chrdev_open+0x4dc/0x600 fs/char_dev.c:411
do_dentry_open+0x849/0x1420 fs/open.c:996
vfs_open+0x3b/0x350 fs/open.c:1101
do_open fs/namei.c:4837 [inline]
path_openat+0x1448/0x1d60 fs/namei.c:5000
do_file_open+0x23e/0x4a0 fs/namei.c:5029
do_sys_openat2+0x115/0x200 fs/open.c:1417
do_sys_open fs/open.c:1423 [inline]
__do_sys_openat fs/open.c:1439 [inline]
__se_sys_openat fs/open.c:1434 [inline]
__x64_sys_openat+0x138/0x170 fs/open.c:1434
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fde12ede159
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:00007fde11136028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007fde13165fa0 RCX: 00007fde12ede159
RDX: 0000000000000002 RSI: 0000200000000100 RDI: ffffffffffffff9c
RBP: 00007fde12f75024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fde13166038 R14: 00007fde13165fa0 R15: 00007ffe150b2898
</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 syzkaller@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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] HID: roccat: fully initialize device before publishing to devices[]
2026-09-06 2:07 [syzbot] [input?] INFO: trying to register non-static key in roccat_open syzbot
@ 2026-09-07 22:44 ` Ivy Lopez
0 siblings, 0 replies; 2+ messages in thread
From: Ivy Lopez @ 2026-09-07 22:44 UTC (permalink / raw)
To: erazor_de, jikos, bentiss
Cc: linux-input, linux-kernel, syzbot+9f7405999979761b6cfc, Ivy Lopez
roccat_connect() published the new device into the global devices[]
array, then released devices_lock, before initializing readers_lock,
cbuf_lock, the wait queue, the readers list, or setting hid/exist/
cbuf_end/report_size on the device.
Since devices[] is checked (under devices_lock) by roccat_open() to
decide whether a device is available to open, a concurrent open()
racing against roccat_connect() could look up the device, then lock
readers_lock before mutex_init() has run on it, or read device->hid
while it is still NULL from kzalloc, once devices_lock is released
but before the remaining fields are set.
Move all initialization of the device's own private state ahead of
the point where it is inserted into devices[], so the object is fully
constructed before it becomes visible to any other reader.
Reported-by: syzbot+9f7405999979761b6cfc@syzkaller.appspotmail.com
Signed-off-by: Ivy Lopez <skunkolee@gmail.com>
---
drivers/hid/hid-roccat.c | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c
index d6fff53d4ee7..53358297e96c 100644
--- a/drivers/hid/hid-roccat.c
+++ b/drivers/hid/hid-roccat.c
@@ -307,26 +307,32 @@ int roccat_connect(const struct class *klass, struct hid_device *hid, int report
if (!device)
return -ENOMEM;
- mutex_lock(&devices_lock);
+ init_waitqueue_head(&device->wait);
+ INIT_LIST_HEAD(&device->readers);
+ mutex_init(&device->readers_lock);
+ mutex_init(&device->cbuf_lock);
+ device->hid = hid;
+ device->exist = 1;
+ device->cbuf_end = 0;
+ device->report_size = report_size;
+ mutex_lock(&devices_lock);
for (minor = 0; minor < ROCCAT_MAX_DEVICES; ++minor) {
if (devices[minor])
continue;
break;
}
-
- if (minor < ROCCAT_MAX_DEVICES) {
- devices[minor] = device;
- } else {
+ if (minor >= ROCCAT_MAX_DEVICES) {
mutex_unlock(&devices_lock);
kfree(device);
return -EINVAL;
}
+ device->minor = minor;
+ devices[minor] = device;
device->dev = device_create(klass, &hid->dev,
MKDEV(roccat_major, minor), NULL,
"%s%s%d", "roccat", hid->driver->name, minor);
-
if (IS_ERR(device->dev)) {
devices[minor] = NULL;
mutex_unlock(&devices_lock);
@@ -334,19 +340,8 @@ int roccat_connect(const struct class *klass, struct hid_device *hid, int report
kfree(device);
return temp;
}
-
mutex_unlock(&devices_lock);
- init_waitqueue_head(&device->wait);
- INIT_LIST_HEAD(&device->readers);
- mutex_init(&device->readers_lock);
- mutex_init(&device->cbuf_lock);
- device->minor = minor;
- device->hid = hid;
- device->exist = 1;
- device->cbuf_end = 0;
- device->report_size = report_size;
-
return minor;
}
EXPORT_SYMBOL_GPL(roccat_connect);
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-07 22:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-06 2:07 [syzbot] [input?] INFO: trying to register non-static key in roccat_open syzbot
2026-09-07 22:44 ` [PATCH] HID: roccat: fully initialize device before publishing to devices[] Ivy Lopez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®