From: sashiko-bot@kernel.org
To: "Rong Zhang" <i@rong.moe>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v7 04/13] HID: haptic: Postpone GET_REPORT to init
Date: Sat, 05 Dec 2026 19:02:20 +0000 [thread overview]
Message-ID: <sashiko-outbox-251838@kernel.org> (raw)
In-Reply-To: <20261206-hid-haptic-kmod-v7-4-3eea47035836@rong.moe>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] HID: haptic: GET_REPORT response dropped in
hid_haptic_get_reports()
--
commit e9a0e0a74b863b6170a9e69a6a306d7df96ed6bd
Author: Rong Zhang <i@rong.moe>
HID: haptic: Postpone GET_REPORT to init
This commit moves the GET_REPORT request for the haptic auto-trigger feature
report from hid_haptic_feature_mapping() to hid_haptic_init() via a new
hid_haptic_get_reports() helper, and parses default_auto_trigger in
parse_auto_trigger_field().
> diff --git a/drivers/hid/hid-haptic.c b/drivers/hid/hid-haptic.c
> index c396a817ec6e5..43e9aa60fca9d 100644
> --- a/drivers/hid/hid-haptic.c
> +++ b/drivers/hid/hid-haptic.c
[ ... ]
> @@ -402,6 +398,16 @@ static void hid_haptic_destroy(struct ff_device *ff)
> haptic->hid_usage_map = NULL;
> }
>
> +static void hid_haptic_get_reports(struct hid_device *hdev, struct hid_haptic_device *haptic)
> +{
> + hid_device_io_start(hdev);
> +
> + hid_hw_request(hdev, haptic->auto_trigger_report, HID_REQ_GET_REPORT);
> +
> + hid_hw_wait(hdev);
> + hid_device_io_stop(hdev);
> +}
> +
> int hid_haptic_init(struct hid_device *hdev,
> struct hid_haptic_device *haptic,
> struct input_dev *dev)
> @@ -438,6 +444,9 @@ int hid_haptic_init(struct hid_device *hdev,
> HID_HP_WAVEFORMSTOP & HID_USAGE;
>
> mutex_init(&haptic->auto_trigger_mutex);
> +
> + hid_haptic_get_reports(hdev, haptic);
> +
> for (r = 0; r < haptic->auto_trigger_report->maxfield; r++)
> parse_auto_trigger_field(haptic, haptic->auto_trigger_report->field[r]);
[Severity: Medium]
Can the GET_REPORT response for auto_trigger_report be silently dropped here?
Previously this ran in report_features() before any hid_input was registered.
Now hid_haptic_init() runs from drv->input_configured() inside the
hidinput_connect() loop, which calls input_register_device() for each
hid_input as it iterates.
On a composite device where an earlier hid_input is registered first,
userspace can open it and call hid_hw_open(), enabling hardware input reports
before hid_haptic_get_reports() runs:
CPU0 (hidinput_connect) CPU1 (input IRQ)
hid_haptic_get_reports()
hid_device_io_start(hdev)
up(&hdev->driver_input_lock)
__hid_input_report()
down_trylock(&driver_input_lock)
hid_hw_request(..., GET_REPORT)
__hid_request()
hid_input_report()
down_trylock() -> -EBUSY <-- response silently dropped
Both __hid_request() and hid_ctrl() ignore the -EBUSY return from
hid_input_report(), so parse_auto_trigger_field() reads zeroed field->value[]
entries. That leaves default_auto_trigger, hid_usage_map[], and
duration_map[] unpopulated, breaking mode switching and waveform uploads.
Fetching the report synchronously with hid_hw_raw_request() and feeding it to
hid_report_raw_event() while keeping driver_input_lock held (as
mt_get_feature() does) avoids releasing the lock and prevents this race.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206-hid-haptic-kmod-v7-0-3eea47035836@rong.moe?part=4
next prev parent reply other threads:[~2026-12-05 19:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 18:41 [PATCH v7 00/13] HID: Add hid-plugin framework & convert hid-haptic into a generic plugin Rong Zhang
2026-12-05 18:41 ` [PATCH v7 01/13] HID: haptic: Get rid of input_ff_destroy() in error paths Rong Zhang
2026-12-05 18:58 ` sashiko-bot
2026-12-05 19:24 ` Rong Zhang
2026-12-05 18:41 ` [PATCH v7 02/13] HID: haptic: Fix use-after-free when draining workqueue Rong Zhang
2026-12-05 18:41 ` [PATCH v7 03/13] HID: haptic, multitouch: Check haptic prerequisite properly Rong Zhang
2026-12-05 19:03 ` sashiko-bot
2026-12-05 19:26 ` Rong Zhang
2026-12-05 18:41 ` [PATCH v7 04/13] HID: haptic: Postpone GET_REPORT to init Rong Zhang
2026-12-05 19:02 ` sashiko-bot [this message]
2026-12-05 19:55 ` Rong Zhang
2026-12-05 18:41 ` [PATCH v7 05/13] HID: Add hid-plugin framework for loadable plugin modules Rong Zhang
2026-12-05 19:12 ` sashiko-bot
2026-12-05 18:41 ` [PATCH v7 06/13] HID: haptic: Convert to a loadable plugin module Rong Zhang
2026-12-05 19:11 ` sashiko-bot
2026-12-05 18:41 ` [PATCH v7 07/13] HID: haptic: Adopt pr_fmt, dev_fmt and hid_*() printk helpers Rong Zhang
2026-12-05 18:41 ` [PATCH v7 08/13] HID: Add Ordinal page defines Rong Zhang
2026-12-05 18:41 ` [PATCH v7 09/13] HID: haptic: Handle list reports separately and make auto trigger optional Rong Zhang
2026-12-05 18:41 ` [PATCH v7 10/13] HID: haptic: Decouple from hid-multitouch and support other devices Rong Zhang
2026-12-05 19:08 ` sashiko-bot
2026-12-05 18:42 ` [PATCH v7 11/13] HID: haptic: Add quirk table Rong Zhang
2026-12-05 18:42 ` [PATCH v7 12/13] HID: haptic: Add HID_HAPTIC_QUIRK_NO_RETRIGGER to disable retriggering Rong Zhang
2026-12-05 18:42 ` [PATCH v7 13/13] HID: haptic: Add quirk flag for Logitech MX Master 4 Rong Zhang
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-251838@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=i@rong.moe \
--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