From: sashiko-bot@kernel.org
To: "Lee Jones" <lee@kernel.org>, linux-input@vger.kernel.org
Cc: dmitry.torokhov@gmail.com
Subject: Re: [PATCH 03/10] HID: logitech-hidpp: Synchronise send_receive_buf against raw events
Date: Mon, 23 Nov 2026 16:14:11 +0000 [thread overview]
Message-ID: <sashiko-outbox-229648@kernel.org> (raw)
In-Reply-To: <20261123155138.2907049-4-lee@kernel.org>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] HID: logitech-hidpp: out-of-bounds read in
hidpp_raw_hidpp_event() [1]
--
commit 289546ca1e2e40f3f7b8470e29a3d15053ba75d0
Author: Lee Jones <lee@kernel.org>
HID: logitech-hidpp: Synchronise send_receive_buf against raw events
This commit adds a spinlock to synchronize access to send_receive_buf and
answer_available between __do_hidpp_send_message_sync() and
hidpp_raw_hidpp_event().
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 60fc6b86a0857..6c95c4bcdd42f 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
[ ... ]
> @@ -4125,27 +4136,33 @@ static int hidpp_raw_hidpp_event(struct hidpp_device *hidpp, u8 *data,
> * previously sent command.
> */
> if (unlikely(mutex_is_locked(&hidpp->send_mutex))) {
> + unsigned long flags;
> + bool matched = false;
> +
> + spin_lock_irqsave(&hidpp->send_receive_lock, flags);
> question = hidpp->send_receive_buf;
> answer = hidpp->send_receive_buf;
>
> - if (!question)
> - return 0;
> -
> /*
> * Check for a correct hidpp20 answer or the corresponding
> * error
> */
> - if (hidpp_match_answer(question, report) ||
> - hidpp_match_error(question, report)) {
> + if (question && (hidpp_match_answer(question, report) ||
> + hidpp_match_error(question, report))) {
> *answer = *report;
[Severity: Critical]
This problem wasn't introduced by this patch, but can hidpp_raw_hidpp_event()
read past the end of data [1] when an undersized HID++ report arrives?
The function casts data to struct hidpp_report without validating the size
parameter, so matching and copying *answer = *report unconditionally reads
sizeof(struct hidpp_report) bytes from the incoming buffer, and the
27 MHz encryption-key check further below likewise reads data[0], data[2],
and data[3] without checking that size >= 4.
[1] https://sashiko.dev/#/bug/linux-f6721ec8-6f81-400f-a691-6d48de7fd9b5
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123155138.2907049-1-lee@kernel.org?part=3
next prev parent reply other threads:[~2026-11-23 16:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 15:50 [PATCH 00/10] HID: Assorted bug fixes across HID core and drivers Lee Jones
2026-11-23 15:50 ` [PATCH 01/10] HID: core: Protect hid->inputs traversal in hid_check_keys_pressed() Lee Jones
2026-11-23 15:50 ` [PATCH 02/10] HID: mcp2221: Synchronise rxbuf access against raw_event callback Lee Jones
2026-11-23 15:50 ` [PATCH 03/10] HID: logitech-hidpp: Synchronise send_receive_buf against raw events Lee Jones
2026-11-23 16:14 ` sashiko-bot [this message]
2026-11-23 15:50 ` [PATCH 04/10] HID: sensor-hub: Serialise synchronous read teardown under data->lock Lee Jones
2026-11-23 16:13 ` sashiko-bot
2026-11-23 15:50 ` [PATCH 05/10] HID: roccat: pyra: Resolve USB device from parent in actual_profile Lee Jones
2026-11-23 15:50 ` [PATCH 06/10] HID: hyperv: Validate VMBus packet and payload bounds on receive Lee Jones
2026-11-23 15:50 ` [PATCH 07/10] HID: hid-goodix-spi: Validate package sizes in goodix_hid_irq() Lee Jones
2026-11-23 15:50 ` [PATCH 08/10] HID: wacom: Stop HID hardware before releasing resources on mode change Lee Jones
2026-11-23 16:08 ` sashiko-bot
2026-11-23 15:50 ` [PATCH 09/10] HID: debug: Hold driver_input_lock while dumping raw report descriptor Lee Jones
2026-11-23 15:50 ` [PATCH 10/10] HID: playstation: Cancel DualSense output worker on create failure Lee Jones
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=sashiko-outbox-229648@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=lee@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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