All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gyeongtaek Lee" <gt82.lee@samsung.com>
To: "'Kuninori Morimoto'" <kuninori.morimoto.gx@renesas.com>,
	<cpgs@samsung.com>
Cc: alsa-devel@alsa-project.org, khw0178.kim@samsung.com,
	'Takashi Iwai' <tiwai@suse.de>,
	'Pierre-Louis Bossart' <pierre-louis.bossart@linux.intel.com>,
	lgirdwood@gmail.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 v2 0/1] ASoC: dpcm: acquire dpcm_lock in dpcm_do_trigger()
Date: Thu, 3 Dec 2020 14:32:23 +0900	[thread overview]
Message-ID: <2038148563.21606973701670.JavaMail.epsvc@epcpadp3> (raw)
In-Reply-To: CGME20201203053224epcas2p1fa702ea12a9869f5c73ec60c760a3131@epcas2p1.samsung.com

On 03 Dec 2020 07:33:03 +0900, Kuninori Morimoto wrote:
>Hi Gyeongtaek
>
>Thank you for your patch
>
>> If stop by underrun and DPCM BE disconnection is run simultaneously,
>> data abort can be occurred by the sequence below.
>> 
>> /* In core X, running dpcm_be_dai_trigger() */
>> for_each_dpcm_be(fe, stream, dpcm) {
>> /* In core Y, running dpcm_be_disconnect() */
>> 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);
>> /* In core X, running dpcm_be_dai_trigger() */
>> struct snd_soc_pcm_runtime *be = dpcm->be;   <== Accessing freed memory
>
>It is easy to read/understand if this code has alignment.
>
>> To prevent this situation, dpcm_lock should be acquired during
>> iteration of dpcm list in dpcm_do_trigger().
>> 
>> Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
>> Cc: stable@vger.kernel.org
>> ---
>
>Is this bugfix patch for some recent commit ?
>If so, having Fixes: tag is helpful.
>
>Thank you for your help !!
I tried to find out some change from the history.
However, I saw that dpcm_lock never be held in dpcm_be_dai_trigger() from the beginning.
So, I just fixed some miss from the commit comment and resend.
If you have another suggestion or request, just let me know.

And I have a question.
This patch can’t be applied to stable branches directly by conflict.
I found out following commits are needed to apply this patch into the 5.4 stable.
 ASoC: soc-pcm: remove snd_soc_dpcm_be_get/set_state()
 ASoC: soc-pcm: add snd_soc_dpcm_can_be() and remove duplicate code
In this case, what should I do when stable maintainer requests resolving conflict to me?
Should I send those patches to the maintainer?
Or rewrite the patch on the latest of the each stable?

Thank you!
Gyeongtaek Lee
>
>Best regards
>---
>Kuninori Morimoto
>

Gyeongtaek Lee (1):
  ASoC: dpcm: acquire dpcm_lock in dpcm_do_trigger()

 sound/soc/soc-pcm.c | 62 ++++++++++++++++++++++++++++++++-------------
 1 file changed, 44 insertions(+), 18 deletions(-)


base-commit: fa02fcd94b0c8dff6cc65714510cf25ad194b90d
-- 
2.21.0




       reply	other threads:[~2020-12-03  5:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20201203053224epcas2p1fa702ea12a9869f5c73ec60c760a3131@epcas2p1.samsung.com>
2020-12-03  5:32 ` Gyeongtaek Lee [this message]
2020-12-03  7:02   ` [PATCH v2 0/1] ASoC: dpcm: acquire dpcm_lock in dpcm_do_trigger() Kuninori Morimoto

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.21606973701670.JavaMail.epsvc@epcpadp3 \
    --to=gt82.lee@samsung.com \
    --cc=alsa-devel@alsa-project.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 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.