From: Dan Carpenter <dan.carpenter@linaro.org>
To: Andrew Ballance <andrewjballance@gmail.com>
Cc: syzbot+07762f019fd03d01f04c@syzkaller.appspotmail.com,
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
Subject: Re: [PATCH] hid: asus: asus_report_fixup: fix potential read out of bounds
Date: Fri, 31 May 2024 11:59:39 +0300 [thread overview]
Message-ID: <d87335b8-9eae-4689-87b4-b581c0b28c9b@moroto.mountain> (raw)
In-Reply-To: <20240528050555.1150628-1-andrewjballance@gmail.com>
On Tue, May 28, 2024 at 12:05:39AM -0500, Andrew Ballance wrote:
> #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++) {
Yep. This looks correct. Please resend with a complete commit message
and a fixes tag etc.
> /* 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) {
regards,
dan carpenter
next prev parent reply other threads:[~2024-05-31 8:59 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 ` [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 ` Dan Carpenter [this message]
2024-06-02 8:50 ` [PATCH v2] hid: asus: asus_report_fixup: fix potential read out of bounds 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=d87335b8-9eae-4689-87b4-b581c0b28c9b@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=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