From: sashiko-bot@kernel.org
To: "Hendrik Noack" <hendrik-noack@gmx.de>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v3 2/2] Input: atmel_mxt_ts: Allow per-machine config via DT compatible
Date: Thu, 28 May 2026 09:28:56 +0000 [thread overview]
Message-ID: <20260528092857.28D781F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260528074317.9604-2-hendrik-noack@gmx.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Concurrent execution of 'mxt_load_fw' via the 'update_fw' sysfs attribute lacks locking, leading to double-free of the input device, TOCTOU races, and interleaved I2C commands.
--
commit eb7b8b6b98800084b750dc1b902ad664e878e3d8
Author: Hendrik Noack <hendrik-noack@gmx.de>
Input: atmel_mxt_ts: Allow per-machine config via DT compatible
The Atmel maXTouch config is machine-dependent, different panels and
layouts require different configs even when the same controller and
firmware is used.
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index a88dc7e6827c7..5ac123d4ed036 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
[ ... ]
> @@ -2291,12 +2351,9 @@ static int mxt_initialize(struct mxt_data *data)
> return -EBUSY;
> }
>
> - error = request_firmware_nowait(THIS_MODULE, true, MXT_CFG_NAME,
> - &client->dev, GFP_KERNEL, data,
> - mxt_config_cb);
> + error = mxt_invoke_config_loader(data, true);
> if (error) {
> - dev_err(&client->dev, "Failed to invoke firmware loader: %d\n",
> - error);
> + dev_err(&client->dev, "Failed to invoke config loader: %d\n", error);
> complete(&data->config_completion);
> return error;
> }
[Severity: High]
This is a pre-existing issue, but I noticed that mxt_update_fw_store()
invokes mxt_load_fw() without any locking to serialize concurrent execution.
Since sysfs write operations don't hold a global lock like device_lock,
could multiple threads concurrently writing to the update_fw attribute race
when checking and setting data->in_bootloader?
If so, could both threads concurrently execute mxt_free_input_device(),
observe a non-null data->input_dev, and invoke input_unregister_device() on
the same pointer before it is set to NULL?
This seems like it might lead to a double-free or use-after-free since
input_unregister_device() drops the reference count.
Could this also race with PM callbacks like mxt_suspend() attempting to
acquire input_dev->mutex, operating on freed memory if
mxt_free_input_device() is executed concurrently?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260528074317.9604-1-hendrik-noack@gmx.de?part=2
next prev parent reply other threads:[~2026-05-28 9:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 7:43 [PATCH v3 1/2] Input: atmel_mxt_ts: Fix async config use-after-free Hendrik Noack
2026-05-28 7:43 ` [PATCH v3 2/2] Input: atmel_mxt_ts: Allow per-machine config via DT compatible Hendrik Noack
2026-05-28 9:28 ` sashiko-bot [this message]
2026-05-28 8:48 ` [PATCH v3 1/2] Input: atmel_mxt_ts: Fix async config use-after-free sashiko-bot
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=20260528092857.28D781F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=hendrik-noack@gmx.de \
--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