From: Andrew Ballance <andrewjballance@gmail.com>
To: syzbot+07762f019fd03d01f04c@syzkaller.appspotmail.com
Cc: benjamin.tissoires@redhat.com, bentiss@kernel.org,
jikos@kernel.org, jkosina@suse.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
luke@ljones.dev, syzkaller-bugs@googlegroups.com,
linux-kernel-mentees@lists.linuxfoundation.org,
skhan@linuxfoundation.org,
Andrew Ballance <andrewjballance@gmail.com>
Subject: [PATCH] hid: asus: asus_report_fixup: fix potential read out of bounds
Date: Tue, 28 May 2024 00:05:39 -0500 [thread overview]
Message-ID: <20240528050555.1150628-1-andrewjballance@gmail.com> (raw)
In-Reply-To: <000000000000915d550619389e8a@google.com>
#syz test
there may be a read out of the bounds of rdesc.
this adds bounds checks
Signed-off-by: Andrew Ballance <andrewjballance@gmail.com>
---
drivers/hid/hid-asus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 02de2bf4f790..37e6d25593c2 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -1204,8 +1204,8 @@ 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++) {
+ if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD && *rsize > 15) {
+ for (int i = 0; i < *rsize - 15; 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) {
--
2.45.1
next prev parent reply other threads:[~2024-05-28 5:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-24 20:00 [syzbot] [input?] [usb?] KMSAN: uninit-value in asus_report_fixup syzbot
2024-05-28 5:05 ` Andrew Ballance [this message]
2024-05-28 5:46 ` 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
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=20240528050555.1150628-1-andrewjballance@gmail.com \
--to=andrewjballance@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=jkosina@suse.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=skhan@linuxfoundation.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;
as well as URLs for NNTP newsgroup(s).