mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+07762f019fd03d01f04c@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [input?] [usb?] KMSAN: uninit-value in asus_report_fixup
Date: Tue, 28 May 2024 20:28:53 +0800	[thread overview]
Message-ID: <tencent_9FA58DAAA5CF0D8B9250DDB2DDF4192FCF07@qq.com> (raw)
In-Reply-To: <000000000000915d550619389e8a@google.com>

please test uv asus_report_fixup

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 70ec81c2e2b4

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 02de2bf4f790..1a92392967fc 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -1204,8 +1204,9 @@ static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 	}
 
 	/* match many more n-key devices */
-	if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
-		for (int i = 0; i < *rsize + 1; i++) {
+	printk("rdesc: %c.%c.%c.%c.%c, %s\n", rdesc[0], rdesc[1], rdesc[2], rdesc[3], rdesc[4], __func__);
+	if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD && *rsize > 15) {
+		for (int i = 0; i < *rsize - 14; i++) {
 			/* offset to the count from 0x5a report part always 14 */
 			if (rdesc[i] == 0x85 && rdesc[i + 1] == 0x5a &&
 			    rdesc[i + 14] == 0x95 && rdesc[i + 15] == 0x05) {
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index a90ed2ceae84..9f0e09f667b1 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1029,7 +1029,7 @@ static int usbhid_parse(struct hid_device *hid)
 		return -EINVAL;
 	}
 
-	rdesc = kmalloc(rsize, GFP_KERNEL);
+	rdesc = kzalloc(rsize, GFP_KERNEL);
 	if (!rdesc)
 		return -ENOMEM;
 


  parent reply	other threads:[~2024-05-28 12:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24 20:00 syzbot
2024-05-28  5:05 ` [PATCH] hid: asus: asus_report_fixup: fix potential read out of bounds Andrew Ballance
2024-05-28  5:46   ` [syzbot] [input?] [usb?] KMSAN: uninit-value in asus_report_fixup syzbot
2024-05-31  8:59   ` [PATCH] hid: asus: asus_report_fixup: fix potential read out of bounds Dan Carpenter
2024-06-02  8:50     ` [PATCH v2] " Andrew Ballance
2024-06-02 10:57       ` Greg KH
2024-06-06  8:31       ` Benjamin Tissoires
2024-05-28 12:28 ` Edward Adam Davis [this message]
2024-05-28 16:05   ` [syzbot] [input?] [usb?] KMSAN: uninit-value in asus_report_fixup syzbot
2024-05-30 14:46   ` Harshit Mogalapalli
2024-05-31  8:53     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_9FA58DAAA5CF0D8B9250DDB2DDF4192FCF07@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+07762f019fd03d01f04c@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome