Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH 7/9] HID: intel-thc-hid: Drop redundant report ID validation in quicki2c
Date: Tue, 13 Oct 2026 03:57:09 +0000	[thread overview]
Message-ID: <sashiko-outbox-168940@kernel.org> (raw)
In-Reply-To: <20261012-hid-core-report-validation-v1-7-e0dd5cb60b2e@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] hid: intel-thc-hid: hidraw GET_REPORT fails if buffer size exceeds report size
- [Medium] HID: intel-thc-hid: information leak via short DMA read
--

commit 75e0494a01241a3ea09c387003f59cc3e7199dc8
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: HID: intel-thc-hid: Drop redundant report ID validation in quicki2c

This commit removes the report ID validation from the Intel QuickI2C driver's
report retrieval path, as the core HID layer now handles this centrally. It
leaves the packet length validation intact.

> diff --git a/drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-protocol.c b/drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-protocol.c
> index 41271301215ab..7a362a2ebe2b3 100644
> --- a/drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-protocol.c
> +++ b/drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-protocol.c
[ ... ]
> @@ -160,9 +160,9 @@ int quicki2c_get_report(struct quicki2c_device *qcdev, u8 report_type,
>  		return ret;
>  	}
>  
> -	if (HIDI2C_DATA_LEN(le16_to_cpu(rpt->len)) != buf_len || rpt->data[0] != reportnum) {
> -		dev_err_once(qcdev->dev, "Invalid packet, len (%d vs %zu) report id (%d vs %d)\n",
> -			     le16_to_cpu(rpt->len), buf_len, rpt->data[0], reportnum);
> +	if (HIDI2C_DATA_LEN(le16_to_cpu(rpt->len)) != buf_len) {

[Severity: High]
Does requiring an exact match for buf_len break the hidraw API? If a
userspace application calls HIDIOCGFEATURE with a standard oversized buffer
(e.g., HID_MAX_BUFFER_SIZE), buf_len will be larger than the actual report
size, causing this check to fail with -EINVAL.

[Severity: Medium]
Is there a risk of leaking stale data on a short DMA read?

If thc_swdma_read() successfully performs a short read, it returns 0 and
sets read_len to a value smaller than expected, leaving the rest of the DMA
buffer stale. Because this check exclusively relies on rpt->len instead of
the updated read_len, a stale rpt->len matching buf_len will pass this
validation.

This would lead to the memcpy() further down in quicki2c_get_report()
copying stale kernel memory into the buffer.

> +		dev_err_once(qcdev->dev, "Invalid packet length (%d vs %zu)\n",
> +			     le16_to_cpu(rpt->len), buf_len);
>  		return -EINVAL;
>  	}
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261012-hid-core-report-validation-v1-0-e0dd5cb60b2e@gmail.com?part=7

  reply	other threads:[~2026-10-13  3:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13  3:42 [PATCH 0/9] HID: Hardening report validation and unnumbered report handling Dmitry Torokhov
2026-10-13  3:42 ` [PATCH 1/9] Bluetooth: HIDP: Fix GET_REPORT and SET_REPORT for unnumbered reports Dmitry Torokhov
2026-10-13  3:57   ` sashiko-bot
2026-10-13  3:42 ` [PATCH 2/9] HID: core: Fix GET_REPORT input processing " Dmitry Torokhov
2026-10-13  4:00   ` sashiko-bot
2026-10-13  3:42 ` [PATCH 3/9] HID: core: Reject mixing numbered and " Dmitry Torokhov
2026-10-13  3:42 ` [PATCH 4/9] HID: core: Validate GET_REPORT report ID centrally Dmitry Torokhov
2026-10-13  4:00   ` sashiko-bot
2026-10-13  3:42 ` [PATCH 5/9] HID: i2c-hid: Drop redundant report ID validation Dmitry Torokhov
2026-10-13  3:42 ` [PATCH 6/9] HID: goodix-spi: " Dmitry Torokhov
2026-10-13  3:42 ` [PATCH 7/9] HID: intel-thc-hid: Drop redundant report ID validation in quicki2c Dmitry Torokhov
2026-10-13  3:57   ` sashiko-bot [this message]
2026-10-13  3:42 ` [PATCH 8/9] HID: multitouch: Drop redundant report ID validation in mt_get_feature Dmitry Torokhov
2026-10-13  3:42 ` [PATCH 9/9] HID: playstation: Drop redundant report ID validation in ps_get_report Dmitry Torokhov

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-168940@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --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