firmware/imx-dsp: Fix use_after_free in imx_dsp_setup_channels()
authorHao Ge <gehao@kylinos.cn>
Sun, 8 Oct 2023 03:29:08 +0000 (11:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Nov 2023 08:35:25 +0000 (09:35 +0100)
commit8d8346ed3968b95cd11e6f2955c793e58a89bf30
tree012a65532ba842b94d0b2c068418cb557f499373
parentdf4169fc9b8a41b4bf411d2688bffbd02377e091
firmware/imx-dsp: Fix use_after_free in imx_dsp_setup_channels()

[ Upstream commit 1558b1a8dd388f5fcc3abc1e24de854a295044c3 ]

dsp_chan->name and chan_name points to same block of memory,
because dev_err still needs to be used it,so we need free
it's memory after use to avoid use_after_free.

Fixes: e527adfb9b7d ("firmware: imx-dsp: Fix an error handling path in imx_dsp_setup_channels()")
Signed-off-by: Hao Ge <gehao@kylinos.cn>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firmware/imx/imx-dsp.c