[PATCH] test: hid_asus

xiaopeitux@foxmail.com posted 1 patch 1 week, 1 day ago
drivers/hid/hid-asus.c | 8 ++++++++
1 file changed, 8 insertions(+)
[PATCH] test: hid_asus
Posted by xiaopeitux@foxmail.com 1 week, 1 day ago
From: Pei Xiao <xiaopei01@kylinos.cn>

#syz test
---
 drivers/hid/hid-asus.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 1b9793f7c07e..8e34063216c7 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -354,6 +354,8 @@ static int asus_wmi_send_event(struct asus_drvdata *drvdata, u8 code)
 static int asus_event(struct hid_device *hdev, struct hid_field *field,
 		      struct hid_usage *usage, __s32 value)
 {
+	struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
+
 	if ((usage->hid & HID_USAGE_PAGE) == HID_USAGE_PAGE_VENDOR &&
 	    (usage->hid & HID_USAGE) != 0x00 &&
 	    (usage->hid & HID_USAGE) != 0xff && !usage->type) {
@@ -361,6 +363,12 @@ static int asus_event(struct hid_device *hdev, struct hid_field *field,
 			 usage->hid & HID_USAGE);
 	}
 
+	if (drvdata->quirks & QUIRK_HID_FN_LOCK &&
+		usage->type == EV_KEY && usage->code == KEY_FN_ESC && value == 1) {
+		drvdata->fn_lock = !drvdata->fn_lock;
+		schedule_work(&drvdata->fn_lock_sync_work);
+	}
+
 	if (usage->type == EV_KEY && value) {
 		switch (usage->code) {
 		case KEY_KBDILLUMUP:
-- 
2.25.1
Re: [syzbot] [input?] [usb?] WARNING in asus_remove
Posted by syzbot 1 week, 1 day ago
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in asus_remove

usb 1-1: USB disconnect, device number 2
------------[ cut here ]------------
!work->func
WARNING: kernel/workqueue.c:4292 at __flush_work+0xb43/0xc50 kernel/workqueue.c:4292, CPU#1: kworker/1:4/5981
Modules linked in:
CPU: 1 UID: 0 PID: 5981 Comm: kworker/1:4 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/24/2026
Workqueue: usb_hub_wq hub_event
RIP: 0010:__flush_work+0xb43/0xc50 kernel/workqueue.c:4292
Code: 75 54 48 8d 65 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc cc e8 cc 87 37 00 90 0f 0b 90 e9 7c ff ff ff e8 be 87 37 00 90 <0f> 0b 90 31 c0 48 bb f8 f8 f8 f8 f8 f8 f8 f8 e9 64 ff ff ff e8 a4
RSP: 0018:ffffc90003a9f080 EFLAGS: 00010293
RAX: ffffffff818db1c2 RBX: 1ffff1100e8eab1c RCX: ffff88802742dac0
RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff8880747558c8
RBP: ffffc90003a9f238 R08: ffffffff903284b7 R09: 1ffffffff2065096
R10: dffffc0000000000 R11: fffffbfff2065097 R12: dffffc0000000000
R13: ffff8880747558e0 R14: 1ffff92000753e18 R15: ffff8880747558c8
FS:  0000000000000000(0000) GS:ffff888125152000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f64d7e51e9c CR3: 000000006163c000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 __cancel_work_sync+0xbe/0x110 kernel/workqueue.c:4451
 asus_remove+0x143/0x180 drivers/hid/hid-asus.c:1355
 hid_device_remove+0x228/0x370 drivers/hid/hid-core.c:-1
 device_remove drivers/base/dd.c:571 [inline]
 __device_release_driver drivers/base/dd.c:1284 [inline]
 device_release_driver_internal+0x46f/0x860 drivers/base/dd.c:1307
 bus_remove_device+0x34d/0x440 drivers/base/bus.c:616
 device_del+0x527/0x8f0 drivers/base/core.c:3878
 hid_remove_device drivers/hid/hid-core.c:3008 [inline]
 hid_destroy_device+0x6b/0x1b0 drivers/hid/hid-core.c:3030
 usbhid_disconnect+0x9f/0xc0 drivers/hid/usbhid/hid-core.c:1477
 usb_unbind_interface+0x26e/0x910 drivers/usb/core/driver.c:458
 device_remove drivers/base/dd.c:573 [inline]
 __device_release_driver drivers/base/dd.c:1284 [inline]
 device_release_driver_internal+0x4d9/0x860 drivers/base/dd.c:1307
 bus_remove_device+0x34d/0x440 drivers/base/bus.c:616
 device_del+0x527/0x8f0 drivers/base/core.c:3878
 usb_disable_device+0x3d4/0x8d0 drivers/usb/core/message.c:1418
 usb_disconnect+0x32f/0x990 drivers/usb/core/hub.c:2345
 hub_port_connect drivers/usb/core/hub.c:5407 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5707 [inline]
 port_event drivers/usb/core/hub.c:5871 [inline]
 hub_event+0x1cc9/0x4f30 drivers/usb/core/hub.c:5953
 process_one_work+0x949/0x15a0 kernel/workqueue.c:3279
 process_scheduled_works kernel/workqueue.c:3362 [inline]
 worker_thread+0xb46/0x1140 kernel/workqueue.c:3443
 kthread+0x388/0x470 kernel/kthread.c:467
 ret_from_fork+0x51b/0xa40 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>


Tested on:

commit:         33a647c6 Add linux-next specific files for 20260129
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=11e1a5b2580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=aef5831c38e37e48
dashboard link: https://syzkaller.appspot.com/bug?extid=13f8286fa2de04a7cd48
compiler:       Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
patch:          https://syzkaller.appspot.com/x/patch.diff?x=17fc1644580000