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=1796384716; b=gT7HzLqnFvOIrprLAQfd1iiK4jpElByeMKTq/lKbZ/7oRZhZb+wmCU0unUjSfbpG91SJ vbQE8wbYV63vxS/otXjRf0i15eCM3WeAmVP2Blneg6lae7T1omiwWUpZlqYu7QHY0uEFV AbAWJQNwllOOBodeHxAI8/kCHN4898XQZE+nIup6JvUaWaHEXBhZxoS7oPBewFlvnKA6U c5fdPIcFgB3ZogZiY3K33oB8mFz1JO4FIefCTEThoqRsUHJj3ygibS3q4mSmzF2xi31CJ XO9bDqZArF1oWlKWmnlNOynx4jcxFe04Wp5Jd3W5VLGR+SiqAB49s437R+Z5t31Hq4w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384716; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=/kyCGQuZGODU6mksnzs8CqCMga3trlY/Pjc4r2XXWBo=; b=DFIh8Sa+rJ+/gmCA1WfPZAN1RxrUzvYtkctD5Gg3cjVXBKWn5UyWziAs4BNE5pM49+JV VfjvRkntggzGNLauztFyeTb6lYH99ylWOFh/ExCCGGlfD+qsaHJ6TbmQZ3igBCmlwW6uO zjYVoQ4kreH47uSau/g7qS+CbHsPHbU0j1gB9U7eQpwTVFinsiXrStgRPigxcG7x0/kDj TY6ErCqYW+kCK1XJ9/FRF/ewnccAswCVRrZNeow+n6xaMiO25mdxdTlnnBb8RXdFElW7d N4AUs9EEqE93ynEWVPXuAqDN5u01N89n6+5w7udd0LAjzI6OYZWI3JKuPxdnxhMUjnw== 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=DodBTyWD; 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 C0292606A338 for ; Fri, 4 Dec 2026 11:45:16 +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=DodBTyWD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B7061F000C2; Fri, 4 Dec 2026 11:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796384716; bh=/kyCGQuZGODU6mksnzs8CqCMga3trlY/Pjc4r2XXWBo=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=DodBTyWDAjODBlXNyvlU+PEcENt9UWZ3pKB2pIVtgBK//xxyMt5TqCN8lMfxOPEnJ iQvaBNWkE0uawT8lmAYi7tpk4EawU/2sStlfrmF7zgqeUbkefvdBu5rE9liCO/uJun wqfwJAzUCUytJ2UUxTnQQCAf95NkjEMD21OOhq087WY6ttgQ7D4wTL9eF3C++FdHU2 tAANcphzE3faageazhy7r8qVGvpAGm8X8iev5myv+scKcF7z6AOxMqutfpffyosv8S ZT997iYTzP1z+DvFuoxJvgnDuxq2sSNswRDbkFvyXyPUfDjAQs/wtt+qk2hhCbPS53 /Z6SbgJ2f1a+w== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 5/9] ASoC: amd: renoir: 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-6-phucduc.bui@gmail.com> References: <20261204111644.63432-1-phucduc.bui@gmail.com> <20261204111644.63432-6-phucduc.bui@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 11:45:16 +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 1 potential issue to consider: - [Medium] ASoC: amd: renoir: substream UAF in pdm_irq_handler() on removal -- commit eccba3fd34658e843b5de01f724905ffd27bc16d Author: bui duc phuc ASoC: amd: renoir: Use devm_pm_runtime_enable() This commit switches acp_pdm_audio_probe() to devm_pm_runtime_enable(), moves runtime PM and IRQ setup before registering the ASoC component, and removes the remove callback. > diff --git a/sound/soc/amd/renoir/acp3x-pdm-dma.c b/sound/soc/amd/renoir/= acp3x-pdm-dma.c > index bea1208f1702a..84ee9b9318581 100644 > --- a/sound/soc/amd/renoir/acp3x-pdm-dma.c > +++ b/sound/soc/amd/renoir/acp3x-pdm-dma.c > @@ -422,6 +422,22 @@ static int acp_pdm_audio_probe(struct platform_devic= e *pdev) > adata->capture_stream =3D NULL; > =20 > dev_set_drvdata(&pdev->dev, adata); > + > + pm_runtime_set_autosuspend_delay(&pdev->dev, ACP_SUSPEND_DELAY_MS); > + pm_runtime_use_autosuspend(&pdev->dev); > + pm_runtime_mark_last_busy(&pdev->dev); > + pm_runtime_set_active(&pdev->dev); > + status =3D devm_pm_runtime_enable(&pdev->dev); > + if (status) > + return status; > + > + status =3D devm_request_irq(&pdev->dev, adata->pdm_irq, pdm_irq_handler, > + irqflags, "ACP_PDM_IRQ", adata); > + if (status) { > + dev_err(&pdev->dev, "ACP PDM IRQ request failed\n"); > + return -ENODEV; > + } > + > status =3D devm_snd_soc_register_component(&pdev->dev, > &acp_pdm_component, > &acp_pdm_dai_driver, 1); [Severity: Medium] Can moving devm_request_irq() before devm_snd_soc_register_component() cause a use-after-free of capture_stream in pdm_irq_handler() on device removal? Because devres actions run in LIFO order, devm_component_release() now runs before devm_irq_release(). Unregistering the component tears down the ALSA card and frees the PCM substreams via snd_card_free() -> snd_pcm_free_stream() while pdm_irq_handler() is still active. Neither snd_pcm_dev_disconnect() (acp_pdm_component has no .sync_stop callback and card->sync_irq is unset) nor acp_pdm_dma_close() calls synchronize_irq() to wait for an in-flight handler: CPU0 (unbind / PCI remove) CPU1 (pdm_irq_handler) acp_pdm_dma_close() reads capture_stream (non-NULL) adata->capture_stream =3D NULL devm_component_release() ... snd_card_free() snd_pcm_free_stream() kfree(substream) snd_pcm_period_elapsed(capture_stream) lock(&substream->self_group.lock) <-- use-after-free devm_irq_release() free_irq() Locking the freed substream in interrupt context can corrupt memory or oops. Keeping devm_request_irq() after devm_snd_soc_register_component() preserves the previous teardown order so free_irq() synchronizes against in-flight handlers before the component is unregistered. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204111644.6343= 2-1-phucduc.bui@gmail.com?part=3D5