* [PATCH v5 0/1] ASoC: dpcm: acquire dpcm_lock in dpcm_do_trigger()
[not found] <CGME20210303060125epcas2p2f8bd60105935980a670a72f8481ddf00@epcas2p2.samsung.com>
@ 2021-03-03 6:01 ` Gyeongtaek Lee
0 siblings, 0 replies; only message in thread
From: Gyeongtaek Lee @ 2021-03-03 6:01 UTC (permalink / raw)
To: 'Kuninori Morimoto', broonie, cpgs
Cc: alsa-devel, khw0178.kim, 'Takashi Iwai', lgirdwood,
'Pierre-Louis Bossart', kimty, donggyun.ko, hmseo, cpgs,
s47.kang, pilsun.jang, tkjung
On Wed, 2021-02-17 16:29, Takashi Iwai wrote:
>On Wed, 17 Feb 2021 05:31:49 +0100,
>Gyeongtaek Lee wrote:
>>
>> If stop by underrun and DPCM BE disconnection is run simultaneously,
>> data abort can be occurred by the sequence below.
>>
>> CPU0 CPU1
>> dpcm_be_dai_trigger(): dpcm_be_disconnect():
>>
>> for_each_dpcm_be(fe, stream, dpcm) {
>>
>> spin_lock_irqsave(&fe->card->dpcm_lock, flags);
>> list_del(&dpcm->list_be);
>> list_del(&dpcm->list_fe);
>> spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
>> kfree(dpcm);
>>
>> struct snd_soc_pcm_runtime *be = dpcm->be; <-- Accessing freed memory
>>
>> To prevent this situation, dpcm_lock should be acquired during
>> iteration of dpcm list in dpcm_be_dai_trigger().
>
>I don't think we can apply spin lock there blindly. There is
>non-atomic PCM that must not take a spin lock there, too.
Hi, Takashi
I fixed the patch to hold dpcm_lock during accessing dpcm related data only,
not on the trigger callback of driver.
Thank you.
Gyeongtaek Lee
>
>
>thanks,
>
>Takashi
>
Gyeongtaek Lee (1):
ASoC: dpcm: acquire dpcm_lock in dpcm_do_trigger()
include/sound/soc-dpcm.h | 5 ++++
sound/soc/soc-pcm.c | 59 +++++++++++++++++++++++++++++++++-------
2 files changed, 54 insertions(+), 10 deletions(-)
base-commit: fe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8
--
2.21.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-03 6:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20210303060125epcas2p2f8bd60105935980a670a72f8481ddf00@epcas2p2.samsung.com>
2021-03-03 6:01 ` [PATCH v5 0/1] ASoC: dpcm: acquire dpcm_lock in dpcm_do_trigger() Gyeongtaek Lee
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.