From: Benjamin Tissoires <bentiss@kernel.org>
To: Lee Jones <lee@kernel.org>
Cc: Jiri Kosina <jikos@kernel.org>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] HID: multitouch: Check to ensure report responses match the request
Date: Mon, 2 Mar 2026 15:31:46 +0100 [thread overview]
Message-ID: <aaWe6PxdZZb2cBJl@beelink> (raw)
In-Reply-To: <20260227163031.1166560-2-lee@kernel.org>
On Feb 27 2026, Lee Jones wrote:
> It is possible for a malicious (or clumsy) device to respond to a
> specific report's feature request using a completely different report
> ID. This can cause confusion in the HID core resulting in nasty
> side-effects such as OOB writes.
>
> Add a check to ensure that the report ID in the response, matches the
> one that was requested. If it doesn't, omit reporting the raw event and
> return early.
>
> Signed-off-by: Lee Jones <lee@kernel.org>
> ---
> drivers/hid/hid-multitouch.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index b1c3ef129058..834c1a334887 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -499,12 +499,19 @@ static void mt_get_feature(struct hid_device *hdev, struct hid_report *report)
> dev_warn(&hdev->dev, "failed to fetch feature %d\n",
> report->id);
> } else {
> + /* The report ID in the request and the response should match */
> + if (report->id != buf[0]) {
> + hid_err(hdev, "Returned feature report did not match the request\n");
> + goto free;
> + }
> +
AFAICT, hid-vivaldi-common.c is doing the same calls to
hid_report_raw_event() in vivaldi_feature_mapping() and would suffer
from the same bug.
It would be nice if we could have the matching fix.
Cheers,
Benjamin
> ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, buf,
> size, 0);
> if (ret)
> dev_warn(&hdev->dev, "failed to report feature\n");
> }
>
> +free:
> kfree(buf);
> }
>
> --
> 2.53.0.473.g4a7958ca14-goog
>
next prev parent reply other threads:[~2026-03-02 14:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 16:30 [PATCH 1/2] HID: core: Mitigate potential OOB by removing bogus memset() Lee Jones
2026-02-27 16:30 ` [PATCH 2/2] HID: multitouch: Check to ensure report responses match the request Lee Jones
2026-03-02 14:31 ` Benjamin Tissoires [this message]
2026-03-17 14:03 ` (subset) " Benjamin Tissoires
2026-03-02 14:29 ` [PATCH 1/2] HID: core: Mitigate potential OOB by removing bogus memset() 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=aaWe6PxdZZb2cBJl@beelink \
--to=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=lee@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.