Patch "ASoC: soc-pcm: Move debugfs removal out of spinlock" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: soc-pcm: Move debugfs removal out of spinlock

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-soc-pcm-move-debugfs-removal-out-of-spinlock.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 9f620684c1ef5a002b6622ecc7b5818e81252f48 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@xxxxxxx>
Date: Wed, 19 Jan 2022 16:52:49 +0100
Subject: ASoC: soc-pcm: Move debugfs removal out of spinlock

From: Takashi Iwai <tiwai@xxxxxxx>

commit 9f620684c1ef5a002b6622ecc7b5818e81252f48 upstream.

The recent fix for DPCM locking also covered the loop in
dpcm_be_disconnect() with the FE stream lock.  This caused an
unexpected side effect, thought: calling debugfs_remove_recursive() in
the spinlock may lead to lockdep splats as the code there assumes the
SOFTIRQ-safe context.

For avoiding the problem, this patch changes the disconnection
procedure to two phases: at first, the matching entries are removed
from the linked list, then the resources are freed outside the lock.

Fixes: b7898396f4bb ("ASoC: soc-pcm: Fix and cleanup DPCM locking")
Reported-and-tested-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
Link: https://lore.kernel.org/r/20220119155249.26754-3-tiwai@xxxxxxx
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 sound/soc/soc-pcm.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1289,6 +1289,7 @@ static void dpcm_be_reparent(struct snd_
 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)
 {
 	struct snd_soc_dpcm *dpcm, *d;
+	LIST_HEAD(deleted_dpcms);
 
 	snd_soc_dpcm_mutex_assert_held(fe);
 
@@ -1308,13 +1309,18 @@ void dpcm_be_disconnect(struct snd_soc_p
 		/* BEs still alive need new FE */
 		dpcm_be_reparent(fe, dpcm->be, stream);
 
-		dpcm_remove_debugfs_state(dpcm);
-
 		list_del(&dpcm->list_be);
+		list_move(&dpcm->list_fe, &deleted_dpcms);
+	}
+	snd_soc_dpcm_stream_unlock_irq(fe, stream);
+
+	while (!list_empty(&deleted_dpcms)) {
+		dpcm = list_first_entry(&deleted_dpcms, struct snd_soc_dpcm,
+					list_fe);
 		list_del(&dpcm->list_fe);
+		dpcm_remove_debugfs_state(dpcm);
 		kfree(dpcm);
 	}
-	snd_soc_dpcm_stream_unlock_irq(fe, stream);
 }
 
 /* get BE for DAI widget and stream */


Patches currently in stable-queue which might be from tiwai@xxxxxxx are

queue-5.15/asoc-dpcm-don-t-pick-up-be-without-substream.patch
queue-5.15/asoc-soc-pcm-fix-and-cleanup-dpcm-locking.patch
queue-5.15/asoc-soc-pcm-fix-dpcm-lockdep-warning-due-to-nested-stream-locks.patch
queue-5.15/asoc-soc-pcm-move-debugfs-removal-out-of-spinlock.patch
queue-5.15/asoc-soc-pcm.c-call-__soc_pcm_close-in-soc_pcm_close.patch
queue-5.15/asoc-soc-pcm-align-be-atomicity-with-that-of-the-fe.patch
queue-5.15/asoc-soc-pcm-serialize-be-triggers.patch
queue-5.15/alsa-caiaq-input-add-error-handling-for-unsupported-.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux