From: Jiri Slaby <jirislaby@kernel.org>
To: Qasim Ijaz <qasdev00@gmail.com>, jikos@kernel.org, bentiss@kernel.org
Cc: envelsavinds@gmail.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] HID: multitouch: fix slab out-of-bounds access in mt_report_fixup()
Date: Thu, 24 Jul 2025 09:01:24 +0200 [thread overview]
Message-ID: <0541891e-2631-43fa-8f3c-a7afb83436b2@kernel.org> (raw)
In-Reply-To: <20250723110036.24439-1-qasdev00@gmail.com>
On 23. 07. 25, 13:00, Qasim Ijaz wrote:
> A malicious HID device can trigger a slab out-of-bounds during
> mt_report_fixup() by passing in report descriptor smaller than
> 607 bytes. mt_report_fixup() attempts to patch byte offset 607
> of the descriptor with 0x25 by first checking if byte offset
> 607 is 0x15 however it lacks bounds checks to verify if the
> descriptor is big enough before conducting this check. Fix
> this bug by ensuring the descriptor size is at least 608
> bytes before accessing it.
>
> Below is the KASAN splat after the out of bounds access happens:
>
> [ 13.671954] ==================================================================
> [ 13.672667] BUG: KASAN: slab-out-of-bounds in mt_report_fixup+0x103/0x110
...
> [...]
>
> Fixes: c8000deb6836 ("HID: multitouch: Add support for GT7868Q")
> Cc: stable@vger.kernel.org
> Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
LGTM
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -1503,6 +1503,14 @@ static const __u8 *mt_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> if (hdev->vendor == I2C_VENDOR_ID_GOODIX &&
> (hdev->product == I2C_DEVICE_ID_GOODIX_01E8 ||
> hdev->product == I2C_DEVICE_ID_GOODIX_01E9)) {
> + if (*size < 608) {
> + dev_info(
Except I would not add \n to the line above.
> + &hdev->dev,
> + "GT7868Q fixup: report descriptor is only %u bytes, skipping\n",
> + *size);
> + return rdesc;
> + }
> +
> if (rdesc[607] == 0x15) {
> rdesc[607] = 0x25;
> dev_info(
thanks,
--
js
suse labs
prev parent reply other threads:[~2025-07-24 7:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-23 11:00 [PATCH v2] HID: multitouch: fix slab out-of-bounds access in mt_report_fixup() Qasim Ijaz
2025-07-24 7:01 ` Jiri Slaby [this message]
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=0541891e-2631-43fa-8f3c-a7afb83436b2@kernel.org \
--to=jirislaby@kernel.org \
--cc=bentiss@kernel.org \
--cc=envelsavinds@gmail.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qasdev00@gmail.com \
--cc=stable@vger.kernel.org \
/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).