On Tue, 02 Feb 2021 17:30:36 +0100, Chris Wilson wrote:
commit 2d670ea2bd53 ("ALSA: jack: implement software jack injection via debugfs") is causing issues for our CI as we see a use-after-free on module unload (on all machines):
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9715/fi-skl-6700k2/pstore0-1...
Could you try the patch below? The unload test was completely forgotten.
thanks,
Takashi
-- 8< -- From: Takashi Iwai tiwai@suse.de Subject: [PATCH] ALSA: core: Fix the debugfs removal at snd_card_free()
The debugfs_remove() call should have been done at the right place before the card object gets freed.
Fixes: 2d670ea2bd53 ("ALSA: jack: implement software jack injection via debugfs") Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/core/init.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/sound/core/init.c b/sound/core/init.c index d4e78b176793..84b573e9c1f9 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -487,6 +487,10 @@ static int snd_card_do_free(struct snd_card *card) dev_warn(card->dev, "unable to free card info\n"); /* Not fatal error */ } +#ifdef CONFIG_SND_DEBUG + debugfs_remove(card->debugfs_root); + card->debugfs_root = NULL; +#endif if (card->release_completion) complete(card->release_completion); kfree(card); @@ -537,11 +541,6 @@ int snd_card_free(struct snd_card *card) /* wait, until all devices are ready for the free operation */ wait_for_completion(&released);
-#ifdef CONFIG_SND_DEBUG - debugfs_remove(card->debugfs_root); - card->debugfs_root = NULL; -#endif - return 0; } EXPORT_SYMBOL(snd_card_free);