From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Lee Jones <lee@kernel.org>
Cc: "Pawel Zalewski" <pzalewski@thegoodpenguin.co.uk>,
"Ronald Tschalär" <ronald@innovation.ch>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 03/10] Input: applespi - cancel touchpad registration work on removal
Date: Mon, 23 Nov 2026 12:13:59 -0800 [thread overview]
Message-ID: <awSebEs9zEV7GDF8@google.com> (raw)
In-Reply-To: <20261123183200.3900004-4-lee@kernel.org>
On Mon, Nov 23, 2026 at 06:31:09PM +0000, Lee Jones wrote:
> applespi_probe() allocates its driver state with devm_kzalloc_obj() and
> initiates an asynchronous touchpad information query whose completion
> schedules applespi->work to allocate and register the managed touchpad
> input device in applespi_worker().
>
> applespi_remove() disables the ACPI GPE and drains in-flight SPI writes
> and reads, but never cancels applespi->work. If a touchpad info
> response scheduled applespi->work just before applespi_drain_reads()
> completed, applespi_worker() can run during or after devres teardown,
> corrupting the device resource list via devm_input_allocate_device() and
> dereferencing freed driver data.
>
> Cancel applespi->work synchronously after applespi_drain_reads(), once
> no further SPI responses can schedule it.
>
> Fixes: 038b1a05eae6 ("Input: add Apple SPI keyboard and trackpad driver")
> Closes: https://sashiko.dev/#/bug/linux-bb2fd773-6c20-468c-a092-6814f008077f
> Cc: stable@vger.kernel.org
> Signed-off-by: Lee Jones <lee@kernel.org>
> ---
> drivers/input/keyboard/applespi.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c
> index 96c504f28495..d964cd3ee5af 100644
> --- a/drivers/input/keyboard/applespi.c
> +++ b/drivers/input/keyboard/applespi.c
> @@ -1819,6 +1819,7 @@ static void applespi_remove(struct spi_device *spi)
> device_wakeup_disable(&spi->dev);
>
> applespi_drain_reads(applespi);
> + cancel_work_sync(&applespi->work);
Likely should be disable_work_sync() instead.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2026-11-23 20:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261123183200.3900004-1-lee@kernel.org>
2026-11-23 18:31 ` [PATCH 01/10] Input: matrix_keypad - validate GPIO counts against matrix limits Lee Jones
2026-11-23 20:12 ` Dmitry Torokhov
2026-11-23 18:31 ` [PATCH 02/10] Input: cyapa - validate firmware image size in cyapa_pip_check_fw() Lee Jones
2026-11-23 18:31 ` [PATCH 03/10] Input: applespi - cancel touchpad registration work on removal Lee Jones
2026-11-23 20:13 ` Dmitry Torokhov [this message]
2026-11-23 18:31 ` [PATCH 04/10] Input: matrix_keypad - only stop and start active device across sleep Lee Jones
2026-11-23 18:31 ` [PATCH 05/10] Input: stinger - zero-initialise driver state in stinger_connect() Lee Jones
2026-11-23 20:19 ` Dmitry Torokhov
2026-11-23 18:31 ` [PATCH 06/10] Input: synaptics-rmi4 - check for NULL drvdata in rmi_set_attn_data() Lee Jones
2026-11-23 18:31 ` [PATCH 07/10] Input: axp20x-pek - skip IRQ handling during sleep without input device Lee Jones
2026-11-23 20:22 ` Dmitry Torokhov
2026-11-23 18:31 ` [PATCH 08/10] Input: mt6779-keypad - enable keypad clock before programming registers Lee Jones
2026-11-23 20:25 ` Dmitry Torokhov
2026-11-23 18:31 ` [PATCH 09/10] Input: pinephone-keyboard - request IRQ before registering input device Lee Jones
2026-11-23 20:25 ` Dmitry Torokhov
2026-11-23 18:31 ` [PATCH 10/10] Input: wacom_w8001 - use reinit_completion() in w8001_command() Lee Jones
2026-11-23 20:26 ` 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=awSebEs9zEV7GDF8@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=lee@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pzalewski@thegoodpenguin.co.uk \
--cc=ronald@innovation.ch \
--cc=stable@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