mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-26 04:20:23 +09:00
UPSTREAM: ASoC: soc-pcm: Move debugfs removal out of spinlock
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. Bug: 291825551 Fixes:b7898396f4("ASoC: soc-pcm: Fix and cleanup DPCM locking") Reported-and-tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Change-Id: I7a793b029cfbddb6082afe001c08890c54c67045 Signed-off-by: Takashi Iwai <tiwai@suse.de> (cherry picked from commit9f620684c1) Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
This commit is contained in:
committed by
Isaac J. Manjarres
parent
4dc2398a95
commit
c2591e463d
@@ -1289,6 +1289,7 @@ static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe,
|
||||
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_pcm_runtime *fe, int stream)
|
||||
/* BEs still alive need new FE */
|
||||
dpcm_be_reparent(fe, dpcm->be, stream);
|
||||
|
||||
dpcm_remove_debugfs_state(dpcm);
|
||||
|
||||
list_del(&dpcm->list_be);
|
||||
list_del(&dpcm->list_fe);
|
||||
kfree(dpcm);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/* get BE for DAI widget and stream */
|
||||
|
||||
Reference in New Issue
Block a user