From: Hyunjung Ko <hj351016@gmail.com>
To: Mark Brown <broonie@kernel.org>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Hyunjung Ko <hj351016@gmail.com>
Subject: [PATCH] ASoC: ak4613: cancel dummy write work on component removal
Date: Tue, 10 Nov 2026 14:44:53 +0900 [thread overview]
Message-ID: <20261110054453.2286414-1-hj351016@gmail.com> (raw)
ak4613_dai_trigger() schedules priv->dummy_write_work on playback start
to issue the PW_MGMT1/PW_MGMT3 dummy writes from a non-atomic context.
The worker dereferences ak4613_priv and accesses the component over I2C.
priv is allocated with devm_kzalloc() and the component driver has no
remove callback, so nothing cancels the work on unbind. If the device is
unbound while the work is still pending, the worker runs after priv has
been freed by devres, resulting in a use-after-free.
Cancel the work from a component remove callback, which runs while priv
and the component are still valid.
Fixes: 03bbf9f5e4eb ("ASoC: ak4613: call dummy write for PW_MGMT1/3 when Playback")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunjung Ko <hj351016@gmail.com>
---
sound/soc/codecs/ak4613.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c
index 0000000..0000000 100644
--- a/sound/soc/codecs/ak4613.c
+++ b/sound/soc/codecs/ak4613.c
@@ -807,7 +807,15 @@ static int ak4613_resume(struct snd_soc_component *component)
return regcache_sync(regmap);
}
+static void ak4613_remove(struct snd_soc_component *component)
+{
+ struct ak4613_priv *priv = snd_soc_component_get_drvdata(component);
+
+ cancel_work_sync(&priv->dummy_write_work);
+}
+
static const struct snd_soc_component_driver soc_component_dev_ak4613 = {
+ .remove = ak4613_remove,
.suspend = ak4613_suspend,
.resume = ak4613_resume,
.set_bias_level = ak4613_set_bias_level,
--
2.43.0
reply other threads:[~2026-11-10 5:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261110054453.2286414-1-hj351016@gmail.com \
--to=hj351016@gmail.com \
--cc=broonie@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.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
all inboxes | Powered by JetHome®