diff mbox series

[1/1] ASoC: stm32: spdifrx: fix dma channel release in stm32_spdifrx_remove

Message ID 20241105140242.527279-1-olivier.moysan@foss.st.com (mailing list archive)
State Accepted
Commit 9bb4af400c386374ab1047df44c508512c08c31f
Headers show
Series [1/1] ASoC: stm32: spdifrx: fix dma channel release in stm32_spdifrx_remove | expand

Commit Message

Olivier Moysan Nov. 5, 2024, 2:02 p.m. UTC
From: Amelie Delaunay <amelie.delaunay@foss.st.com>

In case of error when requesting ctrl_chan DMA channel, ctrl_chan is not
null. So the release of the dma channel leads to the following issue:
[    4.879000] st,stm32-spdifrx 500d0000.audio-controller:
dma_request_slave_channel error -19
[    4.888975] Unable to handle kernel NULL pointer dereference
at virtual address 000000000000003d
[...]
[    5.096577] Call trace:
[    5.099099]  dma_release_channel+0x24/0x100
[    5.103235]  stm32_spdifrx_remove+0x24/0x60 [snd_soc_stm32_spdifrx]
[    5.109494]  stm32_spdifrx_probe+0x320/0x4c4 [snd_soc_stm32_spdifrx]

To avoid this issue, release channel only if the pointer is valid.

Fixes: 794df9448edb ("ASoC: stm32: spdifrx: manage rebind issue")
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
---
 sound/soc/stm/stm32_spdifrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Nov. 5, 2024, 5:53 p.m. UTC | #1
On Tue, 05 Nov 2024 15:02:42 +0100, Olivier Moysan wrote:
> In case of error when requesting ctrl_chan DMA channel, ctrl_chan is not
> null. So the release of the dma channel leads to the following issue:
> [    4.879000] st,stm32-spdifrx 500d0000.audio-controller:
> dma_request_slave_channel error -19
> [    4.888975] Unable to handle kernel NULL pointer dereference
> at virtual address 000000000000003d
> [...]
> [    5.096577] Call trace:
> [    5.099099]  dma_release_channel+0x24/0x100
> [    5.103235]  stm32_spdifrx_remove+0x24/0x60 [snd_soc_stm32_spdifrx]
> [    5.109494]  stm32_spdifrx_probe+0x320/0x4c4 [snd_soc_stm32_spdifrx]
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: stm32: spdifrx: fix dma channel release in stm32_spdifrx_remove
      commit: 9bb4af400c386374ab1047df44c508512c08c31f

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c
index d1b32ba1e1a2..9e30852de93c 100644
--- a/sound/soc/stm/stm32_spdifrx.c
+++ b/sound/soc/stm/stm32_spdifrx.c
@@ -939,7 +939,7 @@  static void stm32_spdifrx_remove(struct platform_device *pdev)
 {
 	struct stm32_spdifrx_data *spdifrx = platform_get_drvdata(pdev);
 
-	if (spdifrx->ctrl_chan)
+	if (!IS_ERR(spdifrx->ctrl_chan))
 		dma_release_channel(spdifrx->ctrl_chan);
 
 	if (spdifrx->dmab)