From: sashiko-bot@kernel.org
To: "Yaohan Li" <shunsheng1218@gmail.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH] ASoC: rt5645: stop timer and delayed works on probe error
Date: Mon, 30 Nov 2026 13:32:48 +0000 [thread overview]
Message-ID: <sashiko-outbox-241254@kernel.org> (raw)
In-Reply-To: <20261130132808.2078478-1-shunsheng1218@gmail.com>
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: rt5645: use-after-free in rt5645_jack_detect_work()
[1]
--
commit 6c5cfa8c0e2764c399b0e7cada712cfd7e7eb7a6
Author: Yaohan Li <shunsheng1218@gmail.com>
ASoC: rt5645: stop timer and delayed works on probe error
This commit shuts down btn_check_timer and cancels jack_detect_work and
rcclock_work on the err_irq path in rt5645_i2c_probe() if component
registration fails.
> diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
> index e14b66d3118da..dbbd12e637e7b 100644
> --- a/sound/soc/codecs/rt5645.c
> +++ b/sound/soc/codecs/rt5645.c
> @@ -4282,6 +4282,9 @@ static int rt5645_i2c_probe(struct i2c_client *i2c)
> err_irq:
> if (rt5645->i2c->irq)
> free_irq(rt5645->i2c->irq, rt5645);
> + timer_shutdown_sync(&rt5645->btn_check_timer);
> + cancel_delayed_work_sync(&rt5645->jack_detect_work);
> + cancel_delayed_work_sync(&rt5645->rcclock_work);
[Severity: Critical]
This problem wasn't introduced by this patch, but can rt5645_remove() trigger
a similar use-after-free in rt5645_jack_detect_work() [1] when the
ASoC sound card is unbound while the I2C device remains bound?
sound/soc/codecs/rt5645.c:rt5645_remove() {
struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component);
rt5645_reset(component);
kfree(rt5645->eq_param);
rt5645->eq_param = NULL;
}
When the sound card is unbound, the ASoC core frees the component and
machine driver jack structures, but rt5645_remove() neither clears
rt5645->component nor stops btn_check_timer and jack_detect_work. Because
the I2C IRQ remains active, a subsequent jack interrupt queues
rt5645_jack_detect_work(), which sees the dangling rt5645->component pointer
and dereferences the freed component and jack structures in
rt5645_jack_detect() and snd_soc_jack_report().
[1] https://sashiko.dev/#/bug/linux-adf839ae-82ba-4d0b-86a4-d5a143d295a8
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130132808.2078478-1-shunsheng1218@gmail.com?part=1
prev parent reply other threads:[~2026-11-30 13:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 13:28 [PATCH] ASoC: rt5645: stop timer and delayed works on probe error Yaohan Li
2026-11-30 13:32 ` sashiko-bot [this message]
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-241254@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shunsheng1218@gmail.com \
/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