From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385141; b=i9nmTAEDKPqFT2OqxCmuX7n9uu14BrHcGcvdcBo+x3T8klsY1I8cg74neEZEqv4P8IYO LEWeFZc4kNx+waOLz8veUgEpBNna5xRH627T0EZ54B8krsmQXiWtGBDP1YkfVfpTfKAgx RFsRRqL7rk6kI3Yii7EfljiP9d6KGeVDSAmqpoVDKxX5i//S+fQaBRbi1YK/ISm71MFvH zuLe+gUQJvkn6NynUB+USKb70kVkCQJBnzRH5O6Uy/Xq1E/z3xq45bXlkepvBpEMcOHC9 N8X0n4KSpkehQ79y4YY1t1OHKf57CUbCnQuJqysAO+rvYHFvi0qCB9hh4un7Z1Iiqwg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385141; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Y1sYfvwSNoy8R7VFgrke9GGg3OOq0wvXqMCNnYQ9XaA=; b=LucE3VOQXQj7BNQMyi68Y83+tSkA2wcpB5SimERKkD4xaSYmi8Mm9UhAFWSmOB98D8N1 nmYKVHUvT4baT2qnafSOaXFEBAkuiUzifomsI6tbxJL9+I9SFBdpzeeJTcxkF31PXSPpW NrZBRNdxQpfHEPkkPRXP49a/GovrIs72kRtdNMzpP3CvniNLppWGOHrpA+ROcUEjD38nJ m0+QDkVhVsN1qKjkDFtyIOdpsmx49mGhpe2BjGaL2yToe0CGnzxfu7Ngpo7zGBrBAWmga MiI5jA+FEYQWTR3yuCcn66jhD8s2tmfrfV7oaRz6TTG+GPg2+AHaB+9kxtNPMRJDlnA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Pnu2c+0h; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4279C606A322 for ; Fri, 4 Dec 2026 11:52:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Pnu2c+0h Received: by smtp.kernel.org (Postfix) with ESMTPSA id D89201F00936; Fri, 4 Dec 2026 11:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796385140; bh=Y1sYfvwSNoy8R7VFgrke9GGg3OOq0wvXqMCNnYQ9XaA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Pnu2c+0hjxKZLAK1irSODPejup+PzZKRTVqlvBlTFvLocb2oIBNshWt6L86YbwW73 pVfWz9CltySU5SI0BgfINpO28Va2ZXxnxS05tJT45AHk4tm3Hi9K6fvFqFz2ZAbHs2 lMC9dCSTBDIS3h+NGyem12T5cSv51FPoFSZ0/ws02GKaD8j1iRXougLBOrXcCSbVkX lFlKLi4tGUnKGZ1AMyvNOIUktuE9fZw7lxbyNNHRhZABI2ndQKl8S3MFljThT0kn1t BrDJI0LJM7PCecAGPzMHuKor/6bKQN/NynZ2XtQdKj4Hl0iyvu36xRyMXQTHU2vRzE lxvh0jenHDIFg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 7/9] ASoC: amd: vangogh: Use devm_pm_runtime_enable() Reply-To: sashiko-reviews@lists.linux.dev To: phucduc.bui@gmail.com Cc: linux-sound@vger.kernel.org In-Reply-To: <20261204111644.63432-8-phucduc.bui@gmail.com> References: <20261204111644.63432-1-phucduc.bui@gmail.com> <20261204111644.63432-8-phucduc.bui@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 11:52:20 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] ASoC: amd: vangogh: substream UAF on unbind from devm_request_irq() reorder - [Low] ASoC: amd: vangogh: commit message omits probe reordering and register write -- commit 48a79efdbd97c6a6e821890453d8f2abe6c27bae Author: bui duc phuc > ASoC: amd: vangogh: Use devm_pm_runtime_enable() > > Use devm_pm_runtime_enable() in the ACP5x PCM DMA driver to > automatically disable runtime PM when the device is removed. > > This allows removing the remove callback. > > Signed-off-by: bui duc phuc [Severity: Low] Should the commit message also describe the other changes in acp5x_audio_probe()? The patch reorders runtime PM, IRQ, and component registration, adds a write to ACP_EXTERNAL_INTR_ENB, and drops the dev_err() calls on failure. Those changes are only listed below the --- separator, which is stripped when applied, leaving the reason for reordering probe and restoring ACP_EXTERNAL_INTR_ENB undocumented in git history. > diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangog= h/acp5x-pcm-dma.c > index 8b09e66610b52..c6a247efe8cfc 100644 > --- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c > +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c > @@ -400,30 +400,25 @@ static int acp5x_audio_probe(struct platform_device= *pdev) > adata->i2s_irq =3D status; > =20 > dev_set_drvdata(&pdev->dev, adata); > - status =3D devm_snd_soc_register_component(&pdev->dev, > - &acp5x_i2s_component, > - NULL, 0); > - if (status) { > - dev_err(&pdev->dev, "Fail to register acp i2s component\n"); > - return status; > - } > - status =3D devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler, > - irqflags, "ACP5x_I2S_IRQ", adata); > - if (status) { > - dev_err(&pdev->dev, "ACP5x I2S IRQ request failed\n"); > - return status; > - } > + > pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); > pm_runtime_use_autosuspend(&pdev->dev); > pm_runtime_mark_last_busy(&pdev->dev); > pm_runtime_set_active(&pdev->dev); > - pm_runtime_enable(&pdev->dev); > - return 0; > -} > + status =3D devm_pm_runtime_enable(&pdev->dev); > + if (status) > + return status; > =20 > -static void acp5x_audio_remove(struct platform_device *pdev) > -{ > - pm_runtime_disable(&pdev->dev); > + status =3D devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler, > + irqflags, "ACP5x_I2S_IRQ", adata); > + if (status) > + return status; > + > + acp_writel(1, adata->acp5x_base + ACP_EXTERNAL_INTR_ENB); > + > + return devm_snd_soc_register_component(&pdev->dev, > + &acp5x_i2s_component, > + NULL, 0); > } [Severity: Medium] Can moving devm_request_irq() ahead of devm_snd_soc_register_component() cause a use-after-free of PCM substreams on device removal? Because devres unwinds in LIFO order, devm_component_release() now runs before devm_irq_release(). acp5x_i2s_component has no .sync_stop or .remove callback, and acp5x_dma_close() clears the stream pointers without locking or synchronize_irq(), so snd_card_free() frees the substreams while i2s_irq_handler() is still active: CPU0 CPU1 devres_release_all() devm_component_release() snd_soc_component_unregister() ... i2s_irq_handler() reads vg_i2s_data->play_stream acp5x_dma_close() adata->play_stream =3D NULL snd_card_free() kfree(substream) snd_pcm_period_elapsed(play_stream) <-- use-after-free devm_irq_release() free_irq() Keeping devm_snd_soc_register_component() before devm_request_irq() ensures free_irq() synchronizes and stops i2s_irq_handler() before the component and its substreams are torn down. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204111644.6343= 2-1-phucduc.bui@gmail.com?part=3D7