* [PATCH] ASoC: soc-compress: Fix deadlock in soc_compr_open_fe
@ 2023-06-13 6:23 yixuanjiang
2023-06-15 0:56 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: yixuanjiang @ 2023-06-13 6:23 UTC (permalink / raw)
To: vkoul, lgirdwood, broonie, perex, tiwai
Cc: alsa-devel, linux-kernel, yixuanjiang, stable
Modify the error handling flow by release lock.
The require pcm_mutex will keep holding if open fail.
Fixes: aa9ff6a4955f ("ASoC: soc-compress: Reposition and add pcm_mutex")
Signed-off-by: yixuanjiang <yixuanjiang@google.com>
Cc: stable@vger.kernel.org # v5.15+
---
sound/soc/soc-compress.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 256e45001f85..b6727b91dd85 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -166,6 +166,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
snd_soc_dai_compr_shutdown(cpu_dai, cstream, 1);
out:
dpcm_path_put(&list);
+ mutex_unlock(&fe->card->pcm_mutex);
be_err:
fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
mutex_unlock(&fe->card->mutex);
--
2.41.0.162.gfafddb0af9-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: soc-compress: Fix deadlock in soc_compr_open_fe
2023-06-13 6:23 [PATCH] ASoC: soc-compress: Fix deadlock in soc_compr_open_fe yixuanjiang
@ 2023-06-15 0:56 ` Mark Brown
2023-06-15 15:26 ` Carlos Llamas
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2023-06-15 0:56 UTC (permalink / raw)
To: yixuanjiang
Cc: vkoul, lgirdwood, perex, tiwai, alsa-devel, linux-kernel, stable
[-- Attachment #1: Type: text/plain, Size: 802 bytes --]
On Tue, Jun 13, 2023 at 02:23:50PM +0800, yixuanjiang wrote:
> Modify the error handling flow by release lock.
> The require pcm_mutex will keep holding if open fail.
> +++ b/sound/soc/soc-compress.c
> @@ -166,6 +166,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
> snd_soc_dai_compr_shutdown(cpu_dai, cstream, 1);
> out:
> dpcm_path_put(&list);
> + mutex_unlock(&fe->card->pcm_mutex);
> be_err:
This is really hard to follow due to the lack of any mutex_lock()s in
the function, I think because this is intended to undo
snd_soc_dpcm_mutex_lock(fe) but if that's the case why is it not using
snd_soc_dpcm_mutex_unlock(fe) like the success path does? Given the use
of classes not doing that looks like it'll create lockdep issues.
I'd expect the unlock to match the lock.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: soc-compress: Fix deadlock in soc_compr_open_fe
2023-06-15 0:56 ` Mark Brown
@ 2023-06-15 15:26 ` Carlos Llamas
0 siblings, 0 replies; 5+ messages in thread
From: Carlos Llamas @ 2023-06-15 15:26 UTC (permalink / raw)
To: Mark Brown
Cc: yixuanjiang, vkoul, lgirdwood, perex, tiwai, alsa-devel,
linux-kernel, stable
On Thu, Jun 15, 2023 at 01:56:35AM +0100, Mark Brown wrote:
> On Tue, Jun 13, 2023 at 02:23:50PM +0800, yixuanjiang wrote:
> > Modify the error handling flow by release lock.
> > The require pcm_mutex will keep holding if open fail.
>
> > +++ b/sound/soc/soc-compress.c
> > @@ -166,6 +166,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
> > snd_soc_dai_compr_shutdown(cpu_dai, cstream, 1);
> > out:
> > dpcm_path_put(&list);
> > + mutex_unlock(&fe->card->pcm_mutex);
> > be_err:
>
> This is really hard to follow due to the lack of any mutex_lock()s in
> the function, I think because this is intended to undo
> snd_soc_dpcm_mutex_lock(fe) but if that's the case why is it not using
> snd_soc_dpcm_mutex_unlock(fe) like the success path does? Given the use
> of classes not doing that looks like it'll create lockdep issues.
>
> I'd expect the unlock to match the lock.
Yes, and judging from the context of the patch I believe this was based
off of stable 5.15.y tree. The locking has been refactored since. So
Yixuan, please rebase/adjust your patch on top of Linus's mainline tree
and resend. Thanks!
--
Carlos Llamas
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ASoC: soc-compress: Fix deadlock in soc_compr_open_fe
@ 2023-06-19 3:31 yixuanjiang
2023-06-21 15:29 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: yixuanjiang @ 2023-06-19 3:31 UTC (permalink / raw)
To: vkoul, lgirdwood, broonie, perex, tiwai
Cc: alsa-devel, linux-kernel, yixuanjiang
Modify the error handling flow by release lock.
The require mutex will keep holding if open fail.
Fixes: aa9ff6a4955f ("ASoC: soc-compress: Reposition and add pcm_mutex")
Signed-off-by: yixuanjiang <yixuanjiang@google.com>
---
sound/soc/soc-compress.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index d8715db5e415..2117fd61cf8f 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -194,6 +194,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
snd_soc_dai_compr_shutdown(cpu_dai, cstream, 1);
out:
dpcm_path_put(&list);
+ snd_soc_dpcm_mutex_unlock(fe);
be_err:
fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
snd_soc_card_mutex_unlock(fe->card);
--
2.41.0.162.gfafddb0af9-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: soc-compress: Fix deadlock in soc_compr_open_fe
2023-06-19 3:31 yixuanjiang
@ 2023-06-21 15:29 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2023-06-21 15:29 UTC (permalink / raw)
To: vkoul, lgirdwood, perex, tiwai, yixuanjiang; +Cc: alsa-devel, linux-kernel
On Mon, 19 Jun 2023 11:31:27 +0800, yixuanjiang wrote:
> Modify the error handling flow by release lock.
> The require mutex will keep holding if open fail.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: soc-compress: Fix deadlock in soc_compr_open_fe
commit: 2222214749a9969e09454b9ba7febfdfb09c1c8d
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-21 15:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-13 6:23 [PATCH] ASoC: soc-compress: Fix deadlock in soc_compr_open_fe yixuanjiang
2023-06-15 0:56 ` Mark Brown
2023-06-15 15:26 ` Carlos Llamas
-- strict thread matches above, loose matches on Subject: below --
2023-06-19 3:31 yixuanjiang
2023-06-21 15:29 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox