Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Gyeongtaek Lee" <gt82.lee@samsung.com>
To: "'Kuninori Morimoto'" <kuninori.morimoto.gx@renesas.com>,
	<broonie@kernel.org>, <cpgs@samsung.com>
Cc: alsa-devel@alsa-project.org, khw0178.kim@samsung.com,
	'Takashi Iwai' <tiwai@suse.de>,
	lgirdwood@gmail.com,
	'Pierre-Louis Bossart' <pierre-louis.bossart@linux.intel.com>,
	kimty@samsung.com, donggyun.ko@samsung.com, hmseo@samsung.com,
	cpgs@samsung.com, s47.kang@samsung.com, pilsun.jang@samsung.com,
	tkjung@samsung.com
Subject: [PATCH v5 0/1] ASoC: dpcm: acquire dpcm_lock in dpcm_do_trigger()
Date: Wed, 3 Mar 2021 15:01:24 +0900	[thread overview]
Message-ID: <2038148563.21614751502179.JavaMail.epsvc@epcpadp3> (raw)
In-Reply-To: CGME20210303060125epcas2p2f8bd60105935980a670a72f8481ddf00@epcas2p2.samsung.com

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




           reply	other threads:[~2021-03-03  6:06 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CGME20210303060125epcas2p2f8bd60105935980a670a72f8481ddf00@epcas2p2.samsung.com>]

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=2038148563.21614751502179.JavaMail.epsvc@epcpadp3 \
    --to=gt82.lee@samsung.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cpgs@samsung.com \
    --cc=donggyun.ko@samsung.com \
    --cc=hmseo@samsung.com \
    --cc=khw0178.kim@samsung.com \
    --cc=kimty@samsung.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=pilsun.jang@samsung.com \
    --cc=s47.kang@samsung.com \
    --cc=tiwai@suse.de \
    --cc=tkjung@samsung.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