From: sashiko-bot@kernel.org
To: "Arina Kharlamova" <arina.kharlamova@mbzuai.ac.ae>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 4/6] ASoC: es9356: disable runtime PM in remove unconditionally
Date: Tue, 01 Dec 2026 19:22:39 +0000 [thread overview]
Message-ID: <sashiko-outbox-244041@kernel.org> (raw)
In-Reply-To: <20261201-s2p-asoc-rpm-v1-4-477189293ad4@mbzuai.ac.ae>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] ASoC: es9356: use-after-free in es9356_sdw_remove() [1]
--
commit 528ed0d483b59e2d6fe68475201f8a4df4ccb91d
Author: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
ASoC: es9356: disable runtime PM in remove unconditionally
This commit removes the first_hw_init check before pm_runtime_disable()
in es9356_sdw_remove() so runtime PM is always disabled when the driver
is unbound.
> diff --git a/sound/soc/codecs/es9356.c b/sound/soc/codecs/es9356.c
> index cc69336dff79e..267db423b6913 100644
> --- a/sound/soc/codecs/es9356.c
> +++ b/sound/soc/codecs/es9356.c
> @@ -1150,8 +1150,7 @@ static void es9356_sdw_remove(struct sdw_slave *slave)
> cancel_delayed_work_sync(&es9356->button_detect_work);
> }
>
> - if (es9356->first_hw_init)
> - pm_runtime_disable(&slave->dev);
> + pm_runtime_disable(&slave->dev);
[Severity: Critical]
This problem wasn't introduced by this patch, but can guarding the work
cancellation above with es9356->hw_init cause a use-after-free [1]
when unattach races with driver unbind?
When es9356_sdw_update_status() handles SDW_SLAVE_UNATTACHED, it clears
es9356->hw_init before canceling interrupt_handle_work and
button_detect_work:
CPU0 CPU1
es9356_sdw_update_status()
es9356->hw_init = false;
es9356_sdw_remove()
if (es9356->hw_init) // false
// devres frees es9356
cancel_delayed_work_sync(...) <-- use-after-free
Because es9356_sdw_remove() skips canceling the delayed works and returns,
devres frees es9356 while es9356_sdw_update_status() or the pending work
handlers still access it. Both delayed works are initialized in
es9356_sdca_init() at probe time, so es9356_sdw_remove() can cancel them
unconditionally.
[1] https://sashiko.dev/#/bug/linux-70b198a2-7241-42b4-a17a-72e02648f7c0
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-s2p-asoc-rpm-v1-0-477189293ad4@mbzuai.ac.ae?part=4
next prev parent reply other threads:[~2026-12-01 19:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 19:06 [PATCH 0/6] ASoC: codecs: Fix runtime PM handling on probe failure and unbind Arina Kharlamova
2026-12-01 19:06 ` Arina Kharlamova via B4 Relay
2026-12-01 19:07 ` [PATCH 1/6] ASoC: cs35l33: Disable runtime PM on component registration failure Arina Kharlamova
2026-12-01 19:07 ` Arina Kharlamova via B4 Relay
2026-12-01 19:07 ` [PATCH 2/6] ASoC: cs35l34: " Arina Kharlamova
2026-12-01 19:07 ` Arina Kharlamova via B4 Relay
2026-12-01 19:07 ` [PATCH 3/6] ASoC: cs47l24: Disable runtime PM on probe failure Arina Kharlamova
2026-12-01 19:07 ` Arina Kharlamova via B4 Relay
2026-12-01 19:07 ` [PATCH 4/6] ASoC: es9356: disable runtime PM in remove unconditionally Arina Kharlamova
2026-12-01 19:07 ` Arina Kharlamova via B4 Relay
2026-12-01 19:22 ` sashiko-bot [this message]
2026-12-01 19:07 ` [PATCH 5/6] ASoC: codecs: rtq9128: Drop runtime PM reference on probe errors Arina Kharlamova
2026-12-01 19:07 ` Arina Kharlamova via B4 Relay
2026-12-02 1:31 ` ChiYuan Huang
2026-12-01 19:07 ` [PATCH 6/6] ASoC: codecs: wsa881x: Disable runtime PM on unbind Arina Kharlamova
2026-12-01 19:07 ` Arina Kharlamova via B4 Relay
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-244041@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arina.kharlamova@mbzuai.ac.ae \
--cc=linux-sound@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.