mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matti Paksula <matti.paksula@gmail.com>
To: Jiri Kosina <jikos@kernel.org>, Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] HID: multitouch: handle empty feature report response in mt_get_feature()
Date: Sun,  6 Dec 2026 10:03:47 +0000	[thread overview]
Message-ID: <20261206100347.6-1-matti.paksula@gmail.com> (raw)

When a transport returns 0 bytes for a GET_REPORT feature request (for
example, i2c_hid_get_report() returns 0 on an empty response where
ret_count <= sizeof(__le16)), hid_hw_raw_request() succeeds without
writing any bytes into the zero-initialized buffer allocated by
hid_alloc_report_buf().

mt_get_feature() only checked for ret < 0, so ret == 0 fell through into
the report ID validation check and compared report->id against the
unwritten buf[0] (0), producing a spurious error:

  hid-multitouch 0018:2C2F:0035.0002: Returned feature report did not match the request

This reproduces on every boot on a Lenovo ThinkPad X1 Carbon Gen 14 with
a Sensel haptic touchpad (SNSL0035:00, 2C2F:0035), where fetching the
Win8 certification blob (feature report ID 7, usage 0xff0000c5) returns
0 bytes. For an unnumbered report (report->id == 0), falling through on
ret == 0 would also feed an unwritten zeroed buffer to
hid_report_raw_event().

Skip the report ID check and raw event dispatch when ret == 0.

Link: https://lore.kernel.org/r/CABE=HBmmH_88d7CVhehXUV-DCCNM=Fepqw_s7i67xtA_AVFm8w@mail.gmail.com
Fixes: e716edafedad ("HID: multitouch: Check to ensure report responses match the request")
Cc: stable@vger.kernel.org
Signed-off-by: Matti Paksula <matti.paksula@gmail.com>
---
 drivers/hid/hid-multitouch.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index f63d6f655..a2af2dc2d 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -540,6 +540,8 @@ static void mt_get_feature(struct hid_device *hdev, struct hid_report *report)
 	if (ret < 0) {
 		dev_warn(&hdev->dev, "failed to fetch feature %d\n",
 			 report->id);
+	} else if (ret == 0) {
+		hid_dbg(hdev, "empty feature report %d\n", report->id);
 	} else {
 		/*
 		 * The report ID in the request and the response should match.
-- 
2.56.1


                 reply	other threads:[~2026-12-06 10:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261206100347.6-1-matti.paksula@gmail.com \
    --to=matti.paksula@gmail.com \
    --cc=bentiss@kernel.org \
    --cc=jikos@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®