[PATCH] ASoC: fsl-asoc-card: Fix ASRC device leak in fsl_asoc_card_probe()

Wentao Liang posted 1 patch 1 week ago
sound/soc/fsl/fsl-asoc-card.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] ASoC: fsl-asoc-card: Fix ASRC device leak in fsl_asoc_card_probe()
Posted by Wentao Liang 1 week ago
of_find_device_by_node() returns the ASRC platform device with a
reference taken, but asrc_pdev is only used during probe to set up the
DPCM DAI links and is never released. The shared exit path already drops
the CPU device reference, so release the ASRC one there too, covering
both the error paths and the successful registration path.

Fixes: 708b4351f08c ("ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 sound/soc/fsl/fsl-asoc-card.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 70a6159430ed..3fdc77d5968b 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -1069,6 +1069,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
 	of_node_put(asrc_np);
 	of_node_put(codec_np[0]);
 	of_node_put(codec_np[1]);
+	if (asrc_pdev)
+		put_device(&asrc_pdev->dev);
 	put_device(&cpu_pdev->dev);
 fail:
 	of_node_put(cpu_np);
-- 
2.34.1
Re: [PATCH] ASoC: fsl-asoc-card: Fix ASRC device leak in fsl_asoc_card_probe()
Posted by Mark Brown 1 week ago
On Thu, Sep 17, 2026 at 04:54:30PM +0000, Wentao Liang wrote:
> of_find_device_by_node() returns the ASRC platform device with a
> reference taken, but asrc_pdev is only used during probe to set up the
> DPCM DAI links and is never released. The shared exit path already drops
> the CPU device reference, so release the ASRC one there too, covering
> both the error paths and the successful registration path.

This doesn't apply against current code, please check and resend.