diff options
author | Hao Ge <gehao@kylinos.cn> | 2023-10-08 06:29:08 +0300 |
---|---|---|
committer | Shawn Guo <shawnguo@kernel.org> | 2023-10-10 05:30:29 +0300 |
commit | 1558b1a8dd388f5fcc3abc1e24de854a295044c3 (patch) | |
tree | a01bd59c5cd2aeebf2f867434aeffd0763210774 /drivers/firmware | |
parent | f09752eaf0e8f8befc26b44c4d3e15633e56d16a (diff) | |
download | linux-1558b1a8dd388f5fcc3abc1e24de854a295044c3.tar.xz |
firmware/imx-dsp: Fix use_after_free in imx_dsp_setup_channels()
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>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/imx/imx-dsp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c index 508eab346fc6..a48a58e0c61f 100644 --- a/drivers/firmware/imx/imx-dsp.c +++ b/drivers/firmware/imx/imx-dsp.c @@ -114,11 +114,11 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc) dsp_chan->idx = i % 2; dsp_chan->ch = mbox_request_channel_byname(cl, chan_name); if (IS_ERR(dsp_chan->ch)) { - kfree(dsp_chan->name); ret = PTR_ERR(dsp_chan->ch); if (ret != -EPROBE_DEFER) dev_err(dev, "Failed to request mbox chan %s ret %d\n", chan_name, ret); + kfree(dsp_chan->name); goto out; } |