From: sashiko-bot@kernel.org
To: "Daniel Golle" <daniel@makrotopia.org>
Cc: conor+dt@kernel.org, robh@kernel.org, dmitry.torokhov@gmail.com,
linux-input@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 3/4] Input: hynitron-cst816x: release gesture keys
Date: Sun, 04 Oct 2026 09:45:57 +0000 [thread overview]
Message-ID: <20261004094557.8B6041F000FF@smtp.kernel.org> (raw)
In-Reply-To: <8c20e53cd026e04774164f869b2be2c5982bdbe0.1791103511.git.daniel@makrotopia.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] input: TOCTOU race in cst816x_release_keys() due to lockless double-read
--
commit 0b6af957c2d032170de5ed337fe23bb294db578d
Author: Daniel Golle <daniel@makrotopia.org>
Input: hynitron-cst816x: release gesture keys
This commit fixes an issue where gesture keys stay pressed when the
gesture stops but the finger remains down. It adds logic to explicitly
release keys held by the input core on the first non-gesture report.
> diff --git a/drivers/input/touchscreen/hynitron-cst816x.c b/drivers/input/touchscreen/hynitron-cst816x.c
> --- a/drivers/input/touchscreen/hynitron-cst816x.c
> +++ b/drivers/input/touchscreen/hynitron-cst816x.c
[ ... ]
> @@ -168,6 +180,18 @@ static void cst816x_reset(struct cst816x_priv *priv)
> msleep(100);
> }
>
> +static void cst816x_release_keys(struct cst816x_priv *priv)
> +{
> + unsigned int i;
> +
> + for (i = 0; i < priv->keycodemax; i++) {
> + if (!test_bit(priv->keycode[i], priv->input->key))
> + continue;
> +
> + input_report_key(priv->input, priv->keycode[i], 0);
[Severity: Medium]
Is there a race condition here due to reading priv->keycode array elements
twice?
Because the priv->keycode array is shared with the input core and
cst816x_release_keys() does not hold the event_lock, a concurrent
EVIOCSKEYCODE ioctl could modify the array between the test_bit() check
and the input_report_key() call.
If this occurs, could the driver spuriously release a completely different
keycode than the one it just tested?
Would it be safer to read the array element into a local variable first to
ensure the exact same keycode is both evaluated and reported?
> + }
> +}
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1791103511.git.daniel@makrotopia.org?part=3
next prev parent reply other threads:[~2026-10-04 9:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-04 9:34 [PATCH v3 0/4] Input: hynitron-cst816x: axes and gesture keys Daniel Golle
2026-10-04 9:34 ` [PATCH v3 1/4] dt-bindings: input: touchscreen: hynitron,cst816x: axes and panel Daniel Golle
2026-10-04 14:46 ` Krzysztof Kozlowski
2026-10-04 9:35 ` [PATCH v3 2/4] Input: hynitron-cst816x: respect touchscreen DT properties Daniel Golle
2026-10-04 9:35 ` [PATCH v3 3/4] Input: hynitron-cst816x: release gesture keys Daniel Golle
2026-10-04 9:45 ` sashiko-bot [this message]
2026-10-04 9:35 ` [PATCH v3 4/4] Input: hynitron-cst816x: time out gesture key release Daniel Golle
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=20261004094557.8B6041F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=daniel@makrotopia.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=robh@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